Release updates

pull/47/head^2
shaun feakes 2019-03-01 09:22:03 -06:00
parent b8c94caa80
commit 7772b1f053
11 changed files with 65 additions and 7 deletions

View File

@ -67,6 +67,11 @@ Designed to mimic AqualinkRS6 All Button keypad, and just like the keypad you ca
* http://aqualink.ip/simple.html <- (Anothr opion if you don't like the above)
* http://aqualink.ip/simulator.html <- (RS8 All Button Control Panel simulator)
#<a name="release"></a>
## Update in Release 1.2.6b
* Added MQTT topic for full SWG status (MQTT section in see wiki)
* Config option to turn on/of listening to extended device information.
* Added service mode topic to MQTT (Thanks to tcm0116)
* Added report zero pool temp (Thanks to tcm0116)
## Update in Release 1.2.6a
* more PDA fixes (Thanks to ballle98)
* Fix in MQTT requests to change temp when temp units are unkown.

View File

@ -9,6 +9,8 @@
//#define POOL_SETPT_TOPIC "Pool_Heater/setpoint"
//#define SPA_SETPT_TOPIC "Spa_Heater/setpoint"
#define SERVICE_MODE_TOPIC "Service_Mode"
#define ENABELED_SUBT "/enabled"
#define SWG_TOPIC "SWG"
@ -18,6 +20,7 @@
#define SWG_PERCENT_TOPIC SWG_TOPIC "/Percent"
#define SWG_PERCENT_F_TOPIC SWG_TOPIC "/Percent_f"
#define SWG_SETPOINT_TOPIC SWG_TOPIC "/setpoint"
#define SWG_EXTENDED_TOPIC SWG_TOPIC "/fullstatus"
#define FREEZE_PROTECT "Freeze_Protect"
#define FREEZE_PROTECT_ENABELED FREEZE_PROTECT ENABELED_SUBT

View File

@ -168,7 +168,8 @@ SPILLOVER IS DISABLED WHILE SPA IS ON
#define SWG_STATUS_ON 0x00
#define SWG_STATUS_NO_FLOW 0x01 // no flow 0x01
#define SWG_STATUS_LOW_SALT 0x02 // low salt 0x02
#define SWG_STATUS_VLOW_SALT 0x04 // very low salt 0x04
//#define SWG_STATUS_VLOW_SALT 0x04 // very low salt 0x04
#define SWG_STATUS_HI_SALT 0x04 // high salt 0x04
#define SWG_STATUS_CLEAN_CELL 0x08 // clean cell 0x10
#define SWG_STATUS_TURNING_OFF 0x09 // turning off 0x09
#define SWG_STATUS_HIGH_CURRENT 0x10 // high current 0x08

View File

@ -95,6 +95,7 @@ struct aqualinkdata
unsigned char ar_swg_status;
int swg_delayed_percent;
bool simulate_panel;
aqledstate service_mode_state;
aqledstate frz_protect_state;
//bool last_msg_was_status;
//bool ar_swg_connected;

View File

@ -195,6 +195,7 @@ void processMessage(char *message)
static bool _initWithRS = false;
static bool _gotREV = false;
static int freeze_msg_count = 0;
static int service_msg_count = 0;
// NSF replace message with msg
msg = stripwhitespace(message);
strcpy(_aqualink_data.last_message, msg);
@ -214,6 +215,11 @@ void processMessage(char *message)
//_aqualink_data.display_message = NULL;
_aqualink_data.last_display_message[0] = '\0';
}
// If we have more than 10 messages without "Service Mode is active" assume it's off.
if (_aqualink_data.service_mode_state == ON && service_msg_count++ > 10) {
_aqualink_data.service_mode_state = OFF;
service_msg_count = 0;
}
// If we have more than 10 messages without "FREE PROTECT ACTIVATED" assume it's off.
if (_aqualink_data.frz_protect_state == ON && freeze_msg_count++ > 10) {
@ -302,6 +308,12 @@ void processMessage(char *message)
logMessage(LOG_NOTICE, "AqualinkD set to 'Pool OR Spa Only' mode\n");
}
}
else if (stristr(msg, LNG_MSG_SERVICE_ACTIVE) != NULL) {
if (_aqualink_data.service_mode_state == OFF)
logMessage(LOG_NOTICE, "AqualinkD set to Service Mode\n");
_aqualink_data.service_mode_state = ON;
service_msg_count = 0;
}
else if (stristr(msg, LNG_MSG_FREEZE_PROTECTION_ACTIVATED) != NULL) {
_aqualink_data.frz_protect_state = ON;
freeze_msg_count = 0;
@ -815,6 +827,7 @@ int main(int argc, char *argv[]) {
logMessage(LOG_NOTICE, "Config serial_port = %s\n", _config_parameters.serial_port);
logMessage(LOG_NOTICE, "Config web_directory = %s\n", _config_parameters.web_directory);
logMessage(LOG_NOTICE, "Config device_id = 0x%02hhx\n", _config_parameters.device_id);
logMessage(LOG_NOTICE, "Config read_all_devices = %s\n", bool2text(_config_parameters.read_all_devices));
logMessage(LOG_NOTICE, "Config override frz prot = %s\n", bool2text(_config_parameters.override_freeze_protect));
#ifndef MG_DISABLE_MQTT
logMessage(LOG_NOTICE, "Config mqtt_server = %s\n", _config_parameters.mqtt_server);
@ -898,6 +911,19 @@ void debugPacket(unsigned char *packet_buffer, int packet_length)
lastID = packet_buffer[PKT_DEST];
}
void logPacket(unsigned char *packet_buffer, int packet_length)
{
static unsigned char last_packet_buffer[AQ_MAXPKTLEN];
static int last_packet_length;
if (packet_buffer[PKT_DEST] != DEV_MASTER) {
memcpy(last_packet_buffer, packet_buffer, packet_length);
last_packet_length = packet_length;
} else {
debugPacketPrint(last_packet_buffer[PKT_DEST], last_packet_buffer, last_packet_length);
debugPacketPrint(last_packet_buffer[PKT_DEST], packet_buffer, packet_length);
}
}
void main_loop() {
@ -926,6 +952,7 @@ void main_loop() {
_aqualink_data.temp_units = UNKNOWN;
_aqualink_data.single_device = false;
_aqualink_data.frz_protect_state = OFF;
_aqualink_data.service_mode_state = OFF;
_aqualink_data.battery = OK;
@ -1028,8 +1055,10 @@ void main_loop() {
broadcast_aqualinkstate(mgr.active_connections);
}
} else if (packet_length > 0) {
// printf("packet not for us %02x\n",packet_buffer[PKT_DEST]);
} else if (packet_length > 0 && _config_parameters.read_all_devices == true) {
//logPacket(packet_buffer, packet_length);
if (packet_buffer[PKT_DEST] == DEV_MASTER && interestedInNextAck == true) {
if ( packet_buffer[PKT_CMD] == CMD_PPM ) {
_aqualink_data.ar_swg_status = packet_buffer[5];

View File

@ -79,6 +79,7 @@ void init_parameters (struct aqconfig * parms)
parms->convert_dz_temp = true;
parms->report_zero_spa_temp = false;
parms->report_zero_pool_temp = false;
parms->read_all_devices = true;
generate_mqtt_id(parms->mqtt_ID, MQTT_ID_LEN);
}
@ -388,6 +389,9 @@ bool setConfigValue(struct aqconfig *config_parameters, struct aqualinkdata *aqd
} else if (strncasecmp (param, "report_zero_pool_temp", 21) == 0) {
config_parameters->report_zero_pool_temp = text2bool(value);
rtn=true;
} else if (strncasecmp (param, "read_all_devices", 16) == 0) {
config_parameters->read_all_devices = text2bool(value);
rtn=true;
}
// removed until domoticz has a better virtual thermostat
/*else if (strncasecmp (param, "pool_thermostat_dzidx", 21) == 0) {
@ -541,6 +545,7 @@ bool writeCfg (struct aqconfig *config_parameters, struct aqualinkdata *aqdata)
fprintf(fp, "socket_port = %s\n", config_parameters->socket_port);
fprintf(fp, "serial_port = %s\n", config_parameters->serial_port);
fprintf(fp, "device_id = 0x%02hhx\n", config_parameters->device_id);
fprintf(fp, "read_all_devices = %s", bool2text(config_parameters->read_all_devices));
writeCharValue(fp, "log_level", errorlevel2text(config_parameters->log_level));
writeCharValue(fp, "web_directory", config_parameters->web_directory);
writeCharValue(fp, "log_file", config_parameters->log_file);

View File

@ -55,6 +55,7 @@ struct aqconfig
bool flash_mqtt_buttons;
bool report_zero_spa_temp;
bool report_zero_pool_temp;
bool read_all_devices;
//int dzidx_pool_thermostat; // Domoticz virtual thermostats are crap removed until better
//int dzidx_spa_thermostat; // Domoticz virtual thermostats are crap removed until better
//char mqtt_pub_topic[250];

View File

@ -294,6 +294,11 @@ void mqtt_broadcast_aqualinkstate(struct mg_connection *nc)
//logMessage(LOG_INFO, "mqtt_broadcast_aqualinkstate: START\n");
if (_aqualink_data->service_mode_state != _last_mqtt_aqualinkdata.service_mode_state) {
_last_mqtt_aqualinkdata.service_mode_state = _aqualink_data->service_mode_state;
send_mqtt_string_msg(nc, SERVICE_MODE_TOPIC, _aqualink_data->service_mode_state==ON?MQTT_ON:MQTT_OFF);
}
if (_aqualink_data->air_temp != TEMP_UNKNOWN && _aqualink_data->air_temp != _last_mqtt_aqualinkdata.air_temp) {
_last_mqtt_aqualinkdata.air_temp = _aqualink_data->air_temp;
send_mqtt_temp_msg(nc, AIR_TEMP_TOPIC, _aqualink_data->air_temp);
@ -388,6 +393,9 @@ 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
@ -413,10 +421,10 @@ void mqtt_broadcast_aqualinkstate(struct mg_connection *nc)
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_VLOW_SALT:
case SWG_STATUS_HI_SALT:
if (!_aqualink_data->simulate_panel)
sprintf(_aqualink_data->last_display_message, "AquaPure Very No flow");
send_domoticz_mqtt_status_message(nc, _aqualink_config->dzidx_swg_status, 3, "VERY LOW SALT");
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_OFF);
break;
case SWG_STATUS_HIGH_CURRENT:

Binary file not shown.

View File

@ -63,6 +63,11 @@ report_zero_pool_temp = no
# Working RS ID's are 0x0a 0x0b 0x09 0x08 <- 0x08 is usually taken
device_id=0x0a
# Read status information from other devices on the RS485 bus.
# At the moment just Salt Water Generators are supported.
read_all_devices = yes
# Button inxed light probramming button is assigned to. (look at your button labels below)
light_programming_button = 0

View File

@ -1,4 +1,4 @@
#define AQUALINKD_NAME "Aqualink Daemon"
#define AQUALINKD_VERSION "1.2.6a"
#define AQUALINKD_VERSION "1.2.6b"