Version 1.3.9

pull/101/merge
sfeakes 2019-10-18 11:53:49 -05:00
parent 9da96ecc5f
commit 259c7bfb43
10 changed files with 245 additions and 140 deletions

View File

@ -32,7 +32,7 @@ CFLAGS = $(GCCFLAGS) $(DBG) $(LIBS) -D MG_DISABLE_MD5 -D MG_DISABLE_HTTP_DIGEST_
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# define the C source files # define the C source files
SRCS = aqualinkd.c utils.c config.c aq_serial.c init_buttons.c aq_programmer.c net_services.c json_messages.c pda.c pda_menu.c pda_aq_programmer.c packetLogger.c pentair_messages.c mongoose.c SRCS = aqualinkd.c utils.c config.c aq_serial.c init_buttons.c aq_programmer.c net_services.c json_messages.c pda.c pda_menu.c pda_aq_programmer.c aquapure.c packetLogger.c pentair_messages.c mongoose.c
DBG_SRC = timespec_subtract.c DBG_SRC = timespec_subtract.c
# If run with `make DEBUG=true` add debug files and pass parameter for compile # If run with `make DEBUG=true` add debug files and pass parameter for compile

View File

@ -66,6 +66,10 @@ Designed to mimic AqualinkRS6 All Button keypad and (like the keypad) is used to
* http://aqualink.ip/simple.html <- (Simple opion if you don't like the above) * http://aqualink.ip/simple.html <- (Simple opion if you don't like the above)
* http://aqualink.ip/simulator.html <- (RS8 All Button Control Panel simulator) * http://aqualink.ip/simulator.html <- (RS8 All Button Control Panel simulator)
#<a name="release"></a> #<a name="release"></a>
# Update in Release 1.3.9
* Added panel Timeout mode support to UI and MQTT
* Fixed SWG bug while in Service & Timeout modes
* Cleanded up SWG code and MQTT status messages for SWG and SWG/enabled
# Update in Release 1.3.8 # Update in Release 1.3.8
* Fixed PDA mode from 1.3.7 * Fixed PDA mode from 1.3.7
* Added SWG Boost to PDA * Added SWG Boost to PDA

View File

@ -41,6 +41,7 @@
#include "pentair_messages.h" #include "pentair_messages.h"
#include "pda_aq_programmer.h" #include "pda_aq_programmer.h"
#include "packetLogger.h" #include "packetLogger.h"
#include "aquapure.h"
#include "version.h" #include "version.h"
@ -1085,7 +1086,7 @@ void main_loop()
unsigned char packet_buffer[AQ_MAXPKTLEN+1]; unsigned char packet_buffer[AQ_MAXPKTLEN+1];
bool interestedInNextAck = false; bool interestedInNextAck = false;
bool changed = false; bool changed = false;
int swg_zero_cnt = 0; //int swg_zero_cnt = 0;
int swg_noreply_cnt = 0; int swg_noreply_cnt = 0;
int i; int i;
//int delayAckCnt = 0; //int delayAckCnt = 0;
@ -1260,21 +1261,7 @@ void main_loop()
if (packet_buffer[PKT_DEST] == DEV_MASTER && interestedInNextAck == true) if (packet_buffer[PKT_DEST] == DEV_MASTER && interestedInNextAck == true)
{ {
swg_noreply_cnt = 0; swg_noreply_cnt = 0;
if (packet_buffer[PKT_CMD] == CMD_PPM) processPacketFromSWG(packet_buffer, packet_length, &_aqualink_data);
{
_aqualink_data.ar_swg_status = packet_buffer[5];
if (_aqualink_data.swg_delayed_percent != TEMP_UNKNOWN && _aqualink_data.ar_swg_status == SWG_STATUS_ON)
{ // We have a delayed % to set.
char sval[10];
snprintf(sval, 9, "%d", _aqualink_data.swg_delayed_percent);
aq_programmer(AQ_SET_SWG_PERCENT, sval, &_aqualink_data);
logMessage(LOG_NOTICE, "Setting SWG %% to %d, from delayed message\n", _aqualink_data.swg_delayed_percent);
_aqualink_data.swg_delayed_percent = TEMP_UNKNOWN;
}
_aqualink_data.swg_ppm = packet_buffer[4] * 100;
changed = true;
//logMessage(LOG_DEBUG, "Read SWG PPM %d from ID 0x%02hhx\n", _aqualink_data.swg_ppm, SWG_DEV_ID);
}
interestedInNextAck = false; interestedInNextAck = false;
} }
//else if (interestedInNextAck == true && packet_buffer[PKT_DEST] != DEV_MASTER && _aqualink_data.ar_swg_status != 0x00) //else if (interestedInNextAck == true && packet_buffer[PKT_DEST] != DEV_MASTER && _aqualink_data.ar_swg_status != 0x00)
@ -1289,33 +1276,7 @@ void main_loop()
else if (packet_buffer[PKT_DEST] == SWG_DEV_ID) else if (packet_buffer[PKT_DEST] == SWG_DEV_ID)
{ {
interestedInNextAck = true; interestedInNextAck = true;
processPacketToSWG(packet_buffer, packet_length, &_aqualink_data, _config_parameters.swg_zero_ignore);
// Only read message from controller to SWG to set SWG Percent if we are not programming, as we might be changing this
if (packet_buffer[3] == CMD_PERCENT && _aqualink_data.active_thread.thread_id == 0 && packet_buffer[4] != 0xFF)
{
// In service or timeout mode SWG set % message is very strange. AR %% | HEX: 0x10|0x02|0x50|0x11|0xff|0x72|0x10|0x03|
// Not really sure what to do with this, just ignore 0xff / 255 for the moment. (if statment above)
// SWG can get ~10 messages to set to 0 then go back again for some reason, so don't go to 0 until 10 messages are received
if (swg_zero_cnt <= _config_parameters.swg_zero_ignore && packet_buffer[4] == 0x00 && packet_buffer[5] == 0x73) {
logMessage(LOG_DEBUG, "Ignoring SWG set to %d due to packet packet count %d <= %d from control panel to SWG 0x%02hhx 0x%02hhx\n", (int)packet_buffer[4],swg_zero_cnt,_config_parameters.swg_zero_ignore,packet_buffer[4],packet_buffer[5]);
swg_zero_cnt++;
} else if (swg_zero_cnt > _config_parameters.swg_zero_ignore && packet_buffer[4] == 0x00 && packet_buffer[5] == 0x73) {
_aqualink_data.swg_percent = (int)packet_buffer[4];
changed = true;
//logMessage(LOG_DEBUG, "SWG set to %d due to packet packet count %d <= %d from control panel to SWG 0x%02hhx 0x%02hhx\n", (int)packet_buffer[4],swg_zero_cnt,SWG_ZERO_IGNORE_COUNT,packet_buffer[4],packet_buffer[5]);
//swg_zero_cnt++;
} else {
swg_zero_cnt = 0;
_aqualink_data.swg_percent = (int)packet_buffer[4];
changed = true;
//logMessage(LOG_DEBUG, "SWG set to %d due to packet from control panel to SWG 0x%02hhx 0x%02hhx\n", _aqualink_data.swg_percent,packet_buffer[4],packet_buffer[5]);
}
if (_aqualink_data.swg_percent > 100)
_aqualink_data.boost = true;
else
_aqualink_data.boost = false;
}
} }
else else
{ {

175
aquapure.c Normal file
View File

@ -0,0 +1,175 @@
#include <stdio.h>
#include "aquapure.h"
#include "aq_serial.h"
#include "aqualink.h"
#include "utils.h"
#include "aq_mqtt.h"
bool processPacketToSWG(unsigned char *packet, int packet_length, struct aqualinkdata *aqdata, int swg_zero_ignore) {
static int swg_zero_cnt = 0;
bool changedAnything = false;
// Only read message from controller to SWG to set SWG Percent if we are not programming, as we might be changing this
if (packet[3] == CMD_PERCENT && aqdata->active_thread.thread_id == 0 && packet[4] != 0xFF) {
// In service or timeout mode SWG set % message is very strange. AR %% | HEX: 0x10|0x02|0x50|0x11|0xff|0x72|0x10|0x03|
// Not really sure what to do with this, just ignore 0xff / 255 for the moment. (if statment above)
// SWG can get ~10 messages to set to 0 then go back again for some reason, so don't go to 0 until 10 messages are received
if (swg_zero_cnt <= swg_zero_ignore && packet[4] == 0x00 && packet[5] == 0x73) {
logMessage(LOG_DEBUG, "Ignoring SWG set to %d due to packet packet count %d <= %d from control panel to SWG 0x%02hhx 0x%02hhx\n", (int)packet[4],
swg_zero_cnt, swg_zero_ignore, packet[4], packet[5]);
swg_zero_cnt++;
} else if (swg_zero_cnt > swg_zero_ignore && packet[4] == 0x00 && packet[5] == 0x73) {
aqdata->swg_percent = (int)packet[4];
changedAnything = true;
// logMessage(LOG_DEBUG, "SWG set to %d due to packet packet count %d <= %d from control panel to SWG 0x%02hhx 0x%02hhx\n",
// (int)packet[4],swg_zero_cnt,SWG_ZERO_IGNORE_COUNT,packet[4],packet[5]); swg_zero_cnt++;
} else {
swg_zero_cnt = 0;
aqdata->swg_percent = (int)packet[4];
changedAnything = true;
// logMessage(LOG_DEBUG, "SWG set to %d due to packet from control panel to SWG 0x%02hhx 0x%02hhx\n",
// aqdata.swg_percent,packet[4],packet[5]);
}
if (aqdata->swg_percent > 100)
aqdata->boost = true;
else
aqdata->boost = false;
}
return changedAnything;
}
bool processPacketFromSWG(unsigned char *packet, int packet_length, struct aqualinkdata *aqdata) {
bool changedAnything = false;
if (packet[PKT_CMD] == CMD_PPM) {
aqdata->ar_swg_status = packet[5];
if (aqdata->swg_delayed_percent != TEMP_UNKNOWN && aqdata->ar_swg_status == SWG_STATUS_ON) { // We have a delayed % to set.
char sval[10];
snprintf(sval, 9, "%d", aqdata->swg_delayed_percent);
aq_programmer(AQ_SET_SWG_PERCENT, sval, aqdata);
logMessage(LOG_NOTICE, "Setting SWG %% to %d, from delayed message\n", aqdata->swg_delayed_percent);
aqdata->swg_delayed_percent = TEMP_UNKNOWN;
}
aqdata->swg_ppm = packet[4] * 100;
changedAnything = true;
// logMessage(LOG_DEBUG, "Read SWG PPM %d from ID 0x%02hhx\n", aqdata.swg_ppm, SWG_DEV_ID);
}
return changedAnything;
}
aqledstate get_swg_led_state(struct aqualinkdata *aqdata)
{
switch (aqdata->ar_swg_status) {
// Level = (0=gray, 1=green, 2=yellow, 3=orange, 4=red)
case SWG_STATUS_ON:
return (aqdata->swg_percent > 0?ON:ENABLE);
break;
case SWG_STATUS_NO_FLOW:
return ENABLE;
break;
case SWG_STATUS_LOW_SALT:
return (aqdata->swg_percent > 0?ON:ENABLE);
break;
case SWG_STATUS_HI_SALT:
return (aqdata->swg_percent > 0?ON:ENABLE);
break;
case SWG_STATUS_HIGH_CURRENT:
return (aqdata->swg_percent > 0?ON:ENABLE);
break;
case SWG_STATUS_TURNING_OFF:
return OFF;
break;
case SWG_STATUS_CLEAN_CELL:
return (aqdata->swg_percent > 0?ON:ENABLE);
return ENABLE;
break;
case SWG_STATUS_LOW_VOLTS:
return ENABLE;
break;
case SWG_STATUS_LOW_TEMP:
return ENABLE;
break;
case SWG_STATUS_CHECK_PCB:
return ENABLE;
break;
case SWG_STATUS_OFF: // THIS IS OUR OFF STATUS, NOT AQUAPURE
return OFF;
break;
default:
return (aqdata->swg_percent > 0?ON:ENABLE);
break;
}
}
void get_swg_status_mqtt(struct aqualinkdata *aqdata, char *message, int *status, int *dzalert)
{
switch (aqdata->ar_swg_status) {
// Level = (0=gray, 1=green, 2=yellow, 3=orange, 4=red)
case SWG_STATUS_ON:
*status = (aqdata->swg_percent > 0?SWG_ON:SWG_OFF);
sprintf(message, "AQUAPURE GENERATING CHLORINE");
*dzalert = 1;
break;
case SWG_STATUS_NO_FLOW:
*status = SWG_OFF;
sprintf(message, "AQUAPURE NO FLOW");
*dzalert = 2;
break;
case SWG_STATUS_LOW_SALT:
*status = (aqdata->swg_percent > 0?SWG_ON:SWG_OFF);
sprintf(message, "AQUAPURE LOW SALT");
*dzalert = 2;
break;
case SWG_STATUS_HI_SALT:
*status = (aqdata->swg_percent > 0?SWG_ON:SWG_OFF);
sprintf(message, "AQUAPURE HIGH SALT");
*dzalert = 3;
break;
case SWG_STATUS_HIGH_CURRENT:
*status = (aqdata->swg_percent > 0?SWG_ON:SWG_OFF);
sprintf(message, "AQUAPURE HIGH CURRENT");
*dzalert = 4;
break;
case SWG_STATUS_TURNING_OFF:
*status = SWG_OFF;
sprintf(message, "AQUAPURE TURNING OFF");
*dzalert = 0;
break;
case SWG_STATUS_CLEAN_CELL:
*status = (aqdata->swg_percent > 0?SWG_ON:SWG_OFF);
sprintf(message, "AQUAPURE CLEAN CELL");
*dzalert = 2;
break;
case SWG_STATUS_LOW_VOLTS:
*status = (aqdata->swg_percent > 0?SWG_ON:SWG_OFF);
sprintf(message, "AQUAPURE LOW VOLTAGE");
*dzalert = 3;
break;
case SWG_STATUS_LOW_TEMP:
*status = SWG_OFF;
sprintf(message, "AQUAPURE WATER TEMP LOW");
*dzalert = 2;
break;
case SWG_STATUS_CHECK_PCB:
*status = SWG_OFF;
sprintf(message, "AQUAPURE CHECK PCB");
*dzalert = 4;
break;
case SWG_STATUS_OFF: // THIS IS OUR OFF STATUS, NOT AQUAPURE
*status = SWG_OFF;
sprintf(message, "AQUAPURE OFF");
*dzalert = 0;
break;
default:
*status = (aqdata->swg_percent > 0?SWG_ON:SWG_OFF);
sprintf(message, "AQUAPURE UNKNOWN STATUS");
*dzalert = 4;
break;
}
}

14
aquapure.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef AQUAPURE_H_
#define AQUAPURE_H_
#include <stdbool.h>
#include "aqualink.h"
bool processPacketToSWG(unsigned char *packet, int packet_length, struct aqualinkdata *aqdata, int swg_zero_ignore);
bool processPacketFromSWG(unsigned char *packet, int packet_length, struct aqualinkdata *aqdata);
void get_swg_status_mqtt(struct aqualinkdata *aqdata, char *message, int *status, int *dzalert);
aqledstate get_swg_led_state(struct aqualinkdata *aqdata);
#endif // AQUAPURE_H_

View File

@ -28,6 +28,7 @@
#include "json_messages.h" #include "json_messages.h"
#include "domoticz.h" #include "domoticz.h"
#include "aq_mqtt.h" #include "aq_mqtt.h"
#include "aquapure.h"
#include "version.h" #include "version.h"
@ -268,7 +269,8 @@ int build_device_JSON(struct aqualinkdata *aqdata, int programable_switch1, int
SWG_TOPIC, SWG_TOPIC,
"Salt Water Generator", "Salt Water Generator",
aqdata->ar_swg_status == SWG_STATUS_OFF?JSON_OFF:JSON_ON, aqdata->ar_swg_status == SWG_STATUS_OFF?JSON_OFF:JSON_ON,
aqdata->ar_swg_status == SWG_STATUS_OFF?JSON_OFF:JSON_ON, //aqdata->ar_swg_status == SWG_STATUS_OFF?JSON_OFF:JSON_ON,
LED2text(get_swg_led_state(aqdata)),
((homekit)?2:0), ((homekit)?2:0),
((homekit_f)?degFtoC(aqdata->swg_percent):aqdata->swg_percent), ((homekit_f)?degFtoC(aqdata->swg_percent):aqdata->swg_percent),
((homekit)?2:0), ((homekit)?2:0),
@ -414,6 +416,7 @@ int build_aqualink_status_JSON(struct aqualinkdata *aqdata, char* buffer, int si
length += sprintf(buffer+length, ",\"leds\":{" ); length += sprintf(buffer+length, ",\"leds\":{" );
for (i=0; i < TOTAL_BUTTONS; i++) for (i=0; i < TOTAL_BUTTONS; i++)
{ {
/*
char *state = JSON_OFF; char *state = JSON_OFF;
switch (aqdata->aqbuttons[i].led->state) switch (aqdata->aqbuttons[i].led->state)
{ {
@ -430,7 +433,8 @@ int build_aqualink_status_JSON(struct aqualinkdata *aqdata, char* buffer, int si
case ENABLE: case ENABLE:
state = JSON_ENABLED; state = JSON_ENABLED;
break; break;
} }*/
char *state = LED2text(aqdata->aqbuttons[i].led->state);
length += sprintf(buffer+length, "\"%s\": \"%s\"", aqdata->aqbuttons[i].name, state); length += sprintf(buffer+length, "\"%s\": \"%s\"", aqdata->aqbuttons[i].name, state);
if (i+1 < TOTAL_BUTTONS) if (i+1 < TOTAL_BUTTONS)
@ -438,7 +442,9 @@ int build_aqualink_status_JSON(struct aqualinkdata *aqdata, char* buffer, int si
} }
if ( aqdata->swg_percent != TEMP_UNKNOWN ) { if ( aqdata->swg_percent != TEMP_UNKNOWN ) {
length += sprintf(buffer+length, ", \"%s\": \"%s\"", SWG_TOPIC, aqdata->ar_swg_status == SWG_STATUS_OFF?JSON_OFF:JSON_ON);
length += sprintf(buffer+length, ", \"%s\": \"%s\"", SWG_TOPIC, LED2text(get_swg_led_state(aqdata)));
//length += sprintf(buffer+length, ", \"%s\": \"%s\"", SWG_TOPIC, aqdata->ar_swg_status == SWG_STATUS_OFF?JSON_OFF:JSON_ON);
length += sprintf(buffer+length, ", \"%s\": \"%s\"", SWG_BOOST_TOPIC, aqdata->boost?JSON_ON:JSON_OFF); length += sprintf(buffer+length, ", \"%s\": \"%s\"", SWG_BOOST_TOPIC, aqdata->boost?JSON_ON:JSON_OFF);
} }
//NSF Need to come back and read what the display states when Freeze protection is on //NSF Need to come back and read what the display states when Freeze protection is on

View File

@ -34,6 +34,7 @@
#include "domoticz.h" #include "domoticz.h"
#include "aq_mqtt.h" #include "aq_mqtt.h"
#include "pda.h" #include "pda.h"
#include "aquapure.h"
static struct aqconfig *_aqualink_config; static struct aqconfig *_aqualink_config;
@ -399,6 +400,35 @@ void mqtt_broadcast_aqualinkstate(struct mg_connection *nc)
send_mqtt_string_msg(nc, BATTERY_STATE, _aqualink_data->battery==OK?MQTT_ON:MQTT_OFF); send_mqtt_string_msg(nc, BATTERY_STATE, _aqualink_data->battery==OK?MQTT_ON:MQTT_OFF);
} }
if (_aqualink_data->ar_swg_status != _last_mqtt_aqualinkdata.ar_swg_status ||
_aqualink_data->swg_percent != _last_mqtt_aqualinkdata.swg_percent) { // Percent can also effect status
char message[30];
int status;
int dzalert;
get_swg_status_mqtt(_aqualink_data, message, &status, &dzalert);
if (!_aqualink_data->simulate_panel)
sprintf(_aqualink_data->last_display_message, message);
send_domoticz_mqtt_status_message(nc, _aqualink_config->dzidx_swg_status, dzalert, &message[10]);
send_mqtt_int_msg(nc, SWG_TOPIC, status);
if (_aqualink_data->ar_swg_status == SWG_STATUS_OFF)
send_mqtt_int_msg(nc, SWG_ENABELED_TOPIC, SWG_OFF);
else
send_mqtt_int_msg(nc, SWG_ENABELED_TOPIC, SWG_ON);
send_mqtt_int_msg(nc, SWG_EXTENDED_TOPIC, (int)_aqualink_data->ar_swg_status);
_last_mqtt_aqualinkdata.ar_swg_status = _aqualink_data->ar_swg_status;
}
if (_aqualink_data->boost != _last_mqtt_aqualinkdata.boost) {
send_mqtt_int_msg(nc, SWG_BOOST_TOPIC, _aqualink_data->boost);
_last_mqtt_aqualinkdata.boost = _aqualink_data->boost;
}
//if (_aqualink_data->ar_swg_status == SWG_STATUS_ON) { // If the SWG is actually on //if (_aqualink_data->ar_swg_status == SWG_STATUS_ON) { // If the SWG is actually on
if (_aqualink_data->ar_swg_status != SWG_STATUS_OFF) { // If the SWG is actually on if (_aqualink_data->ar_swg_status != SWG_STATUS_OFF) { // If the SWG is actually on
if (_aqualink_data->swg_percent != TEMP_UNKNOWN && (force_update || _aqualink_data->swg_percent != _last_mqtt_aqualinkdata.swg_percent)) { if (_aqualink_data->swg_percent != TEMP_UNKNOWN && (force_update || _aqualink_data->swg_percent != _last_mqtt_aqualinkdata.swg_percent)) {
@ -416,96 +446,6 @@ void mqtt_broadcast_aqualinkstate(struct mg_connection *nc)
} }
} }
if (_aqualink_data->ar_swg_status != _last_mqtt_aqualinkdata.ar_swg_status) {
send_mqtt_int_msg(nc, SWG_EXTENDED_TOPIC, (int)_aqualink_data->ar_swg_status);
if (_aqualink_data->ar_swg_status == SWG_STATUS_OFF)
send_mqtt_int_msg(nc, SWG_ENABELED_TOPIC, SWG_OFF);
else
send_mqtt_int_msg(nc, SWG_ENABELED_TOPIC, SWG_ON);
switch (_aqualink_data->ar_swg_status) {
// Level = (0=gray, 1=green, 2=yellow, 3=orange, 4=red)
case SWG_STATUS_ON:
if (!_aqualink_data->simulate_panel)
sprintf(_aqualink_data->last_display_message, "AquaPure ON");
send_domoticz_mqtt_status_message(nc, _aqualink_config->dzidx_swg_status, 1, "GENERATING CHLORINE");
send_mqtt_int_msg(nc, SWG_TOPIC, SWG_ON);
break;
case SWG_STATUS_NO_FLOW:
if (!_aqualink_data->simulate_panel)
sprintf(_aqualink_data->last_display_message, "AquaPure No Flow");
send_domoticz_mqtt_status_message(nc, _aqualink_config->dzidx_swg_status, 2, "NO FLOW");
send_mqtt_int_msg(nc, SWG_TOPIC, SWG_OFF);
break;
case SWG_STATUS_LOW_SALT:
if (!_aqualink_data->simulate_panel)
sprintf(_aqualink_data->last_display_message, "AquaPure Low Salt");
send_domoticz_mqtt_status_message(nc, _aqualink_config->dzidx_swg_status, 2, "LOW SALT");
send_mqtt_int_msg(nc, SWG_TOPIC, SWG_ON);
break;
case SWG_STATUS_HI_SALT:
if (!_aqualink_data->simulate_panel)
sprintf(_aqualink_data->last_display_message, "AquaPure High Salt");
send_domoticz_mqtt_status_message(nc, _aqualink_config->dzidx_swg_status, 3, "HIGH SALT");
send_mqtt_int_msg(nc, SWG_TOPIC, SWG_ON);
break;
case SWG_STATUS_HIGH_CURRENT:
if (!_aqualink_data->simulate_panel)
sprintf(_aqualink_data->last_display_message, "AquaPure High Current");
send_domoticz_mqtt_status_message(nc, _aqualink_config->dzidx_swg_status, 4, "HIGH CURRENT");
send_mqtt_int_msg(nc, SWG_TOPIC, SWG_ON);
break;
case SWG_STATUS_TURNING_OFF:
if (!_aqualink_data->simulate_panel)
sprintf(_aqualink_data->last_display_message, "AquaPure Turning Off");
send_domoticz_mqtt_status_message(nc, _aqualink_config->dzidx_swg_status, 0, "TURNING OFF");
send_mqtt_int_msg(nc, SWG_TOPIC, SWG_OFF);
break;
case SWG_STATUS_CLEAN_CELL:
if (!_aqualink_data->simulate_panel)
sprintf(_aqualink_data->last_display_message, "AquaPure Clean Cell");
send_domoticz_mqtt_status_message(nc, _aqualink_config->dzidx_swg_status, 2, "CLEAN CELL");
send_mqtt_int_msg(nc, SWG_TOPIC, SWG_ON);
break;
case SWG_STATUS_LOW_VOLTS:
if (!_aqualink_data->simulate_panel)
sprintf(_aqualink_data->last_display_message, "AquaPure Low Voltage");
send_domoticz_mqtt_status_message(nc, _aqualink_config->dzidx_swg_status, 3, "LOW VOLTAGE");
send_mqtt_int_msg(nc, SWG_TOPIC, SWG_ON);
break;
case SWG_STATUS_LOW_TEMP:
if (!_aqualink_data->simulate_panel)
sprintf(_aqualink_data->last_display_message, "AquaPure Water Temp Low");
send_domoticz_mqtt_status_message(nc, _aqualink_config->dzidx_swg_status, 2, "WATER TEMP LOW");
send_mqtt_int_msg(nc, SWG_TOPIC, SWG_OFF);
break;
case SWG_STATUS_CHECK_PCB:
if (!_aqualink_data->simulate_panel)
sprintf(_aqualink_data->last_display_message, "AquaPure Check PCB");
send_domoticz_mqtt_status_message(nc, _aqualink_config->dzidx_swg_status, 4, "CHECK PCB");
send_mqtt_int_msg(nc, SWG_TOPIC, SWG_OFF);
break;
case SWG_STATUS_OFF: // THIS IS OUR OFF STATUS, NOT AQUAPURE
if (!_aqualink_data->simulate_panel)
sprintf(_aqualink_data->last_display_message, "AquaPure OFF");
send_domoticz_mqtt_status_message(nc, _aqualink_config->dzidx_swg_status, 0, "OFF");
send_mqtt_int_msg(nc, SWG_TOPIC, SWG_OFF);
break;
default:
send_domoticz_mqtt_status_message(nc, _aqualink_config->dzidx_swg_status, 4, "Unknown");
send_mqtt_int_msg(nc, SWG_TOPIC, SWG_ON);
break;
}
_last_mqtt_aqualinkdata.ar_swg_status = _aqualink_data->ar_swg_status;
}
if (_aqualink_data->boost != _last_mqtt_aqualinkdata.boost) {
send_mqtt_int_msg(nc, SWG_BOOST_TOPIC, _aqualink_data->boost);
_last_mqtt_aqualinkdata.boost = _aqualink_data->boost;
}
//logMessage(LOG_INFO, "mqtt_broadcast_aqualinkstate: START LEDs\n"); //logMessage(LOG_INFO, "mqtt_broadcast_aqualinkstate: START LEDs\n");
//if (time(NULL) % 2) {} <-- use to determin odd/even second in time to make state flash on enabled. //if (time(NULL) % 2) {} <-- use to determin odd/even second in time to make state flash on enabled.

Binary file not shown.

View File

@ -1,4 +1,4 @@
#define AQUALINKD_NAME "Aqualink Daemon" #define AQUALINKD_NAME "Aqualink Daemon"
#define AQUALINKD_VERSION "1.3.8a" #define AQUALINKD_VERSION "1.3.9"

View File

@ -860,10 +860,15 @@
if (type == 'setpoint_swg') { if (type == 'setpoint_swg') {
if (tile.getAttribute('Boost') == 'on') if (tile.getAttribute('Boost') == 'on')
text = "Boost"; text = "Boost";
else if (status == 'enabled')
text = 'Enabled';
else else
text = 'Generating'; text = 'Generating';
} }
else if (type == 'setpoint_thermo') else if (type == 'setpoint_thermo')
if (status == 'enabled')
text = 'Heat to ' + tile.getAttribute('setpoint');
else
text = 'Heating to ' + tile.getAttribute('setpoint'); text = 'Heating to ' + tile.getAttribute('setpoint');
else if (type == 'setpoint_freeze') else if (type == 'setpoint_freeze')
text = 'Turn on ' + tile.getAttribute('setpoint') + "&deg;"; text = 'Turn on ' + tile.getAttribute('setpoint') + "&deg;";