mirror of https://github.com/sfeakes/AqualinkD.git
Merge branch 'master' into master
commit
9acea4a263
|
@ -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.
|
||||
|
|
|
@ -20,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
|
||||
|
|
|
@ -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
|
||||
|
|
26
aqualinkd.c
26
aqualinkd.c
|
@ -215,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 "Service Mode is active" assume it's off.
|
||||
if (_aqualink_data.service_mode_state == ON && service_msg_count++ > 10) {
|
||||
|
@ -828,6 +833,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);
|
||||
|
@ -911,6 +917,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() {
|
||||
|
@ -940,6 +959,7 @@ void main_loop() {
|
|||
_aqualink_data.single_device = false;
|
||||
_aqualink_data.service_mode_state = OFF;
|
||||
_aqualink_data.frz_protect_state = OFF;
|
||||
_aqualink_data.service_mode_state = OFF;
|
||||
_aqualink_data.battery = OK;
|
||||
|
||||
|
||||
|
@ -1042,8 +1062,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];
|
||||
|
|
5
config.c
5
config.c
|
@ -80,6 +80,7 @@ void init_parameters (struct aqconfig * parms)
|
|||
parms->report_zero_pool_temp = false;
|
||||
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);
|
||||
}
|
||||
|
@ -394,6 +395,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) {
|
||||
|
@ -547,6 +551,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);
|
||||
|
|
1
config.h
1
config.h
|
@ -56,6 +56,7 @@ struct aqconfig
|
|||
bool report_zero_pool_temp;
|
||||
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];
|
||||
|
|
|
@ -297,6 +297,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);
|
||||
|
@ -410,6 +415,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
|
||||
|
@ -435,10 +443,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.
|
@ -69,6 +69,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
|
||||
|
||||
|
|
Loading…
Reference in New Issue