diff --git a/README.md b/README.md
index 6012c2c..1bac5a8 100644
--- a/README.md
+++ b/README.md
@@ -141,6 +141,7 @@ NEED TO FIX FOR THIS RELEASE.
* cleaned up code for spa_mode and spa for newer pannels.
* Allow VSP to be asigned to virtual button.
* Fixed bug with timer not starting.
+* Increase Speed of detecting device state changes.
# Updates in Release 2.4.0
* WARNING Breaking change if you use dimmer (please change button_??_lightMode from 6 to 10)
diff --git a/docker/aqexec-pre.sh b/docker/aqexec-pre.sh
index f9532fd..f136f0f 100644
--- a/docker/aqexec-pre.sh
+++ b/docker/aqexec-pre.sh
@@ -6,10 +6,11 @@
# This file should be placed in the config aqualinkd directory defined
# in your docker-compose.yml (or equiv)
#
-# MAKE SURE TO CHAGE THE IP BELOW
-#
+# MAKE SURE TO CHAGE THE IP BELOW (1.1.1.1)
+# aqualinkd.cong should have serial_port=/dev/ttyEW11
echo "Starting SOCAT port binding....."
-socat -d -d pty,link=/dev/tty.Pool2,raw TCP:192.168.99.248:8899 &
+socat -d -d pty,link=/dev/ttyEW11,raw,ignoreeof TCP4:1.1.1.1:8899,ignoreeof &
+sudo docker compose up
echo "Sleeping for SOCAT start....."
sleep 2s
\ No newline at end of file
diff --git a/release/aqualinkd-amd64 b/release/aqualinkd-amd64
index 3a514e4..07712d8 100755
Binary files a/release/aqualinkd-amd64 and b/release/aqualinkd-amd64 differ
diff --git a/release/aqualinkd-arm64 b/release/aqualinkd-arm64
index 671dff1..f18fc7d 100755
Binary files a/release/aqualinkd-arm64 and b/release/aqualinkd-arm64 differ
diff --git a/release/aqualinkd-armhf b/release/aqualinkd-armhf
index 62a1e3a..641f7f5 100755
Binary files a/release/aqualinkd-armhf and b/release/aqualinkd-armhf differ
diff --git a/release/serial_logger-amd64 b/release/serial_logger-amd64
index 738a1e3..0580d49 100755
Binary files a/release/serial_logger-amd64 and b/release/serial_logger-amd64 differ
diff --git a/release/serial_logger-arm64 b/release/serial_logger-arm64
index fcc041b..67e9422 100755
Binary files a/release/serial_logger-arm64 and b/release/serial_logger-arm64 differ
diff --git a/release/serial_logger-armhf b/release/serial_logger-armhf
index a0724c0..0593b4f 100755
Binary files a/release/serial_logger-armhf and b/release/serial_logger-armhf differ
diff --git a/source/allbutton.c b/source/allbutton.c
index 3730633..701db55 100644
--- a/source/allbutton.c
+++ b/source/allbutton.c
@@ -9,14 +9,27 @@
#include "devices_jandy.h"
#include "allbutton_aq_programmer.h"
-void processLEDstate(struct aqualinkdata *aq_data)
+/* Below can also be called from serialadapter.c */
+void processLEDstate(struct aqualinkdata *aq_data, unsigned char *packet, logmask_t from)
{
int i = 0;
int byte;
int bit;
+ if (memcmp(aq_data->raw_status, packet + 4, AQ_PSTLEN) != 0) {
+ aq_data->updated = true;
+ LOG(from,LOG_DEBUG, "Processing LEDs status CHANGED\n");
+ } else {
+ LOG(from,LOG_DEBUG, "Processing LEDs status\n");
+ // Their is no point in continuing here, so we could return if wanted.
+ // But for the moment, we don't need to speed up anything.
+ }
+
+ memcpy(aq_data->raw_status, packet + 4, AQ_PSTLEN);
+
//debuglogPacket(ALLB_LOG, );
+
for (byte = 0; byte < 5; byte++)
{
@@ -29,7 +42,7 @@ void processLEDstate(struct aqualinkdata *aq_data)
else
aq_data->aqualinkleds[i].state = OFF;
- //LOG(ALLB_LOG,LOG_DEBUG,"Led %d state %d",i+1,aq_data->aqualinkleds[i].state);
+ //LOG(from,LOG_DEBUG,"Led %d state %d",i+1,aq_data->aqualinkleds[i].state);
i++;
}
}
@@ -44,14 +57,14 @@ void processLEDstate(struct aqualinkdata *aq_data)
aq_data->aqualinkleds[SOLAR_HTR_LED_INDEX - 1].state = ENABLE;
/*
for (i=0; i < TOTAL_BUTTONS; i++) {
- LOG(ALLB_LOG,LOG_NOTICE, "%s = %d", aq_data->aqbuttons[i].name, aq_data->aqualinkleds[i].state);
+ LOG(from,LOG_NOTICE, "%s = %d", aq_data->aqbuttons[i].name, aq_data->aqualinkleds[i].state);
}
*/
#ifdef CLIGHT_PANEL_FIX // Use state from RSSD protocol for color light if it's on.
for (int i=0; i < aq_data->num_lights; i++) {
if ( aq_data->lights[i].RSSDstate == ON && aq_data->lights[i].button->led->state != ON ) {
aq_data->lights[i].button->led->state = aq_data->lights[i].RSSDstate;
- //LOG(ALLB_LOG,LOG_WARNING,"Fix Jandy bug, color light '%s' is on, setting status to match!\n", aq_data->lights[i].button->label);
+ //LOG(from,LOG_WARNING,"Fix Jandy bug, color light '%s' is on, setting status to match!\n", aq_data->lights[i].button->label);
}
}
#endif
@@ -641,8 +654,10 @@ bool process_allbutton_packet(unsigned char *packet, int length, struct aqualink
case CMD_STATUS:
//LOG(ALLB_LOG,LOG_DEBUG, "RS Received STATUS length %d.\n", length);
//debuglogPacket(ALLB_LOG, packet, length, true, true);
- memcpy(aq_data->raw_status, packet + 4, AQ_PSTLEN);
- processLEDstate(aq_data);
+
+ //memcpy(aq_data->raw_status, packet + 4, AQ_PSTLEN);
+ //processLEDstate(aq_data);
+ processLEDstate(aq_data, packet, ALLB_LOG);
/* NSF Take this out, and use the ALLButton loop cycle to determin if we get spa/pool temp
messages. Works better for dual equiptment when both pool & spa pumps and dual temp sensors */
diff --git a/source/allbutton.h b/source/allbutton.h
index ed01660..02d7d23 100644
--- a/source/allbutton.h
+++ b/source/allbutton.h
@@ -2,7 +2,7 @@
#define ALLBUTTON_H_
-
+void processLEDstate(struct aqualinkdata *aq_data, unsigned char *packet, logmask_t from);
bool process_allbutton_packet(unsigned char *packet, int length, struct aqualinkdata *aq_data);
#endif //ALLBUTTON_H_
\ No newline at end of file
diff --git a/source/aq_panel.c b/source/aq_panel.c
index b1d858b..d7383d4 100644
--- a/source/aq_panel.c
+++ b/source/aq_panel.c
@@ -627,9 +627,9 @@ void initPanelButtons(struct aqualinkdata *aqdata, bool rs, int size, bool combo
aqdata->aqbuttons[index].led = &aqdata->aqualinkleds[19-1];
aqdata->aqbuttons[index].led->state = LED_S_UNKNOWN;
- aqdata->aqbuttons[index].label = rs?name2label(BTN_SOLAR_HTR):BTN_PDA_SOLAR_HTR;
- aqdata->aqbuttons[index].name = BTN_SOLAR_HTR;
- aqdata->aqbuttons[index].code = KEY_SOLAR_HTR;
+ aqdata->aqbuttons[index].label = rs?name2label(BTN_EXT_AUX):BTN_PDA_EXT_AUX;
+ aqdata->aqbuttons[index].name = BTN_EXT_AUX;
+ aqdata->aqbuttons[index].code = KEY_EXT_AUX;
aqdata->aqbuttons[index].dz_idx = DZ_NULL_IDX;
aqdata->aqbuttons[index].special_mask = 0;
index++;
@@ -809,7 +809,7 @@ bool setDeviceState(struct aqualinkdata *aqdata, int deviceIndex, bool isON, req
//#ifdef PRESTATE_ONOFF
if (_aqconfig_.device_pre_state) {
if ((button->code == KEY_POOL_HTR || button->code == KEY_SPA_HTR ||
- button->code == KEY_SOLAR_HTR) &&
+ button->code == KEY_EXT_AUX) &&
isON > 0) {
button->led->state = ENABLE; // if heater and set to on, set pre-status to enable.
//_aqualink_data->updated = true;
diff --git a/source/aq_serial.c b/source/aq_serial.c
index a480ea9..81d1c50 100644
--- a/source/aq_serial.c
+++ b/source/aq_serial.c
@@ -250,6 +250,9 @@ const char* get_jandy_packet_type(unsigned char* packet , int length)
case CMD_IAQ_MSG_LONG:
return "iAq Popup message";
break;
+ case CMD_IAQ_AUX_STATUS:
+ return "iAq AUX status";
+ break;
case RSSA_DEV_STATUS:
// This is a fail reply 0x10|0x02|0x48|0x13|0x02|0x00|0x10|0x00|0x7f|0x10|0x03|
// Rather than check all, just check 0x02 and checksum sin't I'm not sure 0x10 means faiure without 0x00 around it.
diff --git a/source/aq_serial.h b/source/aq_serial.h
index b8f5b52..2891b84 100644
--- a/source/aq_serial.h
+++ b/source/aq_serial.h
@@ -46,6 +46,10 @@ const char *getJandyDeviceName(emulation_type etype);
#define JANDY_DEC_SWG_MAX 83 // 0x53
#define JANDY_DEC_PUMP_MIN 120 // 0x78
#define JANDY_DEC_PUMP_MAX 123 // 0x7b
+// Have also seen epump at 0xe0 with panel rev W that supports more pumps
+#define JANDY_DEC_PUMP2_MIN 224 // 0xe0
+#define JANDY_DEC_PUMP2_MAX 228 // 0xe3 // Their are probably more, but this is a guess
+
#define JANDY_DEC_JXI_MIN 104 // 0x68
#define JANDY_DEC_JXI_MAX 107 // 0x6B
#define JANDY_DEC_LX_MIN 56 // 0x38
@@ -204,7 +208,8 @@ DEV_UNKNOWN_MASK = 0xF8; // Unknown mask, used to reset values
#define KEY_AUX7 0x15
#define KEY_POOL_HTR 0x12
#define KEY_SPA_HTR 0x17
-#define KEY_SOLAR_HTR 0x1c
+//#define KEY_SOLAR_HTR 0x1c
+#define KEY_EXT_AUX 0x1c
#define KEY_MENU 0x09
#define KEY_CANCEL 0x0e
#define KEY_LEFT 0x13
@@ -242,7 +247,8 @@ DEV_UNKNOWN_MASK = 0xF8; // Unknown mask, used to reset values
#define BTN_AUX7 "Aux_7"
#define BTN_POOL_HTR "Pool_Heater"
#define BTN_SPA_HTR "Spa_Heater"
-#define BTN_SOLAR_HTR "Solar_Heater"
+//#define BTN_SOLAR_HTR "Solar_Heater"
+#define BTN_EXT_AUX "Extra_Aux"
#define BTN_TEMP1_HTR "Temp1_Heater"
#define BTN_TEMP2_HTR "Temp2_Heater"
@@ -271,7 +277,8 @@ DEV_UNKNOWN_MASK = 0xF8; // Unknown mask, used to reset values
#define BTN_PDA_AUX7 "AUX7"
#define BTN_PDA_POOL_HTR "POOL HEAT"
#define BTN_PDA_SPA_HTR "SPA HEAT"
-#define BTN_PDA_SOLAR_HTR "EXTRA AUX"
+//#define BTN_PDA_SOLAR_HTR "EXTRA AUX"
+#define BTN_PDA_EXT_AUX "EXTRA AUX"
#define BUTTON_LABEL_LENGTH 20
@@ -402,6 +409,9 @@ SPILLOVER IS DISABLED WHILE SPA IS ON
#define CMD_IAQ_TITLE_MESSAGE 0x2d // This is what the product name is set to (Jandy RS) usually
//#define CMD_IAQ_VSP_ERROR 0x2c // Error when setting speed too high
#define CMD_IAQ_MSG_LONG 0x2c // This this is display popup message. Next 2 bytes 0x00|0x01 = wait and then 0x00|0x00 clear
+
+// If
+#define CMD_IAQ_AUX_STATUS 0x72 // Get this on AqualinkTouch protocol when iAqualink protocol sends 0x18 (get aux status I assume)
/*
#define CMD_IAQ_MSG_3 0x2d // Equiptment status message??
#define CMD_IAQ_0x31 0x31 // Some pump speed info
diff --git a/source/aqualinkd.c b/source/aqualinkd.c
index 2eb9a91..d7a6e81 100644
--- a/source/aqualinkd.c
+++ b/source/aqualinkd.c
@@ -625,8 +625,7 @@ int startup(char *self, char *cfgFile)
LOG(AQUA_LOG,LOG_NOTICE, "Config light_pgm_mode = %.2f\n", _aqconfig_.light_programming_mode);
LOG(AQUA_LOG,LOG_NOTICE, "Debug RS485 protocol = %s\n", bool2text(_aqconfig_.log_protocol_packets));
LOG(AQUA_LOG,LOG_NOTICE, "Debug RS485 protocol raw = %s\n", bool2text(_aqconfig_.log_raw_bytes));
- if ( _aqconfig_.RSSD_LOG_filter != NUL)
- LOG(AQUA_LOG,LOG_NOTICE, "Log RS485 packets from = 0x%02hhx\n", _aqconfig_.RSSD_LOG_filter);
+
//LOG(AQUA_LOG,LOG_NOTICE, "Use PDA 4 auxiliary info = %s\n", bool2text(_aqconfig_.use_PDA_auxiliary));
//LOG(AQUA_LOG,LOG_NOTICE, "Read Pentair Packets = %s\n", bool2text(_aqconfig_.read_pentair_packets));
// logMessage (LOG_NOTICE, "Config serial_port = %s\n", config_parameters->serial_port);
@@ -774,39 +773,7 @@ void caculate_ack_packet(int rs_fd, unsigned char *packet_buffer, emulation_type
//DEBUG_TIMER_STOP(_rs_packet_timer,AQUA_LOG,"AquaTouch Emulation type Processed packet in");
break;
case IAQUALNK:
- /*
- Probe | HEX: 0x10|0x02|0xa3|0x00|0xb5|0x10|0x03|
- Ack | HEX: 0x10|0x02|0x00|0x01|0x00|0x00|0x13|0x10|0x03|
- Unknown '0x61' | HEX: 0x10|0x02|0xa3|0x61|0x00|0x00|0x00|0x04|0x00|0x27|0x41|0x10|0x03|
- Ack | HEX: 0x10|0x02|0x00|0x01|0x61|0x00|0x74|0x10|0x03|
- Unknown '0x50' | HEX: 0x10|0x02|0xa3|0x50|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x00|0x25|0x10|0x03|
- Ack | HEX: 0x10|0x02|0x00|0x01|0x50|0x00|0x63|0x10|0x03|
- Unknown '0x51' | HEX: 0x10|0x02|0xa3|0x51|0x00|0x06|0x10|0x03|
- Ack | HEX: 0x10|0x02|0x00|0x01|0x51|0x00|0x64|0x10|0x03|
- Unknown '0x59' | HEX: 0x10|0x02|0xa3|0x59|0x00|0x0e|0x10|0x03|
- Ack | HEX: 0x10|0x02|0x00|0x01|0x59|0x00|0x6c|0x10|0x03|
- Unknown '0x52' | HEX: 0x10|0x02|0xa3|0x52|0x00|0x07|0x10|0x03|
- Ack | HEX: 0x10|0x02|0x00|0x01|0x52|0x00|0x65|0x10|0x03|
- Unknown '0x53' | HEX: 0x10|0x02|0xa3|0x53|0x08|0x10|0x03|
- Ack | HEX: 0x10|0x02|0x00|0x01|0x3f|0x00|0x52|0x10|0x03|
- Use byte 3 as return ack, except for 0x53=0x3f
- */
- if (packet_buffer[PKT_CMD] == 0x53) {
- /*
- static int cnt=0;
- if (cnt++ > 10) {
- cnt=0;
- LOG(IAQL_LOG,LOG_NOTICE, "Sending get bigass packet\n");
- send_extended_ack(rs_fd, 0x3f, 0x18);
- } else*/ {
- // Use 0x3f
- send_extended_ack(rs_fd, 0x3f, 0x00);
- }
- send_jandy_command(rs_fd, get_rssa_cmd(packet_buffer[PKT_CMD]), 4);
- } else {
- // Use packet_buffer[PKT_CMD]
- send_extended_ack(rs_fd, packet_buffer[PKT_CMD], 0x00);
- }
+ send_iaqualink_ack(rs_fd, packet_buffer);
break;
#endif
#ifdef AQ_PDA
diff --git a/source/config.c b/source/config.c
index dcd10ac..781a60d 100644
--- a/source/config.c
+++ b/source/config.c
@@ -83,7 +83,10 @@ void init_parameters (struct aqconfig * parms)
//parms->device_id = strtoul(DEFAULT_DEVICE_ID, &p, 16);
parms->device_id = strtoul(DEFAULT_DEVICE_ID, NULL, 16);
parms->rssa_device_id = NUL;
- parms->RSSD_LOG_filter = NUL;
+
+ for (int i=0; i < MAX_RSSD_LOG_FILTERS; i++) {
+ parms->RSSD_LOG_filter[i] = NUL;
+ }
parms->paneltype_mask = 0;
#if defined AQ_ONETOUCH || defined AQ_IAQTOUCH
parms->extended_device_id = NUL;
@@ -398,7 +401,12 @@ bool setConfigValue(struct aqualinkdata *aqdata, char *param, char *value) {
_aqconfig_.rssa_device_id = strtoul(cleanalloc(value), NULL, 16);
rtn=true;
} else if (strncasecmp(param, "RSSD_LOG_filter", 15) == 0) {
- _aqconfig_.RSSD_LOG_filter = strtoul(cleanalloc(value), NULL, 16);
+ for (int i=0; i < MAX_RSSD_LOG_FILTERS; i++) {
+ if (_aqconfig_.RSSD_LOG_filter[i] == NUL) {
+ _aqconfig_.RSSD_LOG_filter[i] = strtoul(cleanalloc(value), NULL, 16);
+ break;
+ }
+ }
rtn=true;
#if defined AQ_ONETOUCH || defined AQ_IAQTOUCH
} else if (strncasecmp (param, "extended_device_id_programming", 30) == 0) {
diff --git a/source/config.h b/source/config.h
index 2560756..546bd4e 100644
--- a/source/config.h
+++ b/source/config.h
@@ -32,6 +32,8 @@
#define READ_RS485_JAN_LX (1 << 4) // Jandy LX heater
#define READ_RS485_JAN_CHEM (1 << 5) // Jandy Chemical Feeder
+#define MAX_RSSD_LOG_FILTERS 4
+
struct aqconfig
{
char *config_file;
@@ -47,6 +49,7 @@ struct aqconfig
unsigned char extended_device_id2;
bool extended_device_id_programming;
bool enable_iaqualink;
+ //bool enable_RS_device_value_print;
#endif
bool deamonize;
#ifndef AQ_MANAGER // Need to uncomment and clean up referances in future.
@@ -89,7 +92,7 @@ struct aqconfig
bool display_warnings_web;
bool log_protocol_packets; // Read & Write as packets
bool log_raw_bytes; // Read as bytes
- unsigned char RSSD_LOG_filter;
+ unsigned char RSSD_LOG_filter[MAX_RSSD_LOG_FILTERS];
//bool log_raw_RS_bytes;
/*
#ifdef AQ_RS_EXTRA_OPTS
diff --git a/source/devices_jandy.c b/source/devices_jandy.c
index 641c8cb..556bda0 100644
--- a/source/devices_jandy.c
+++ b/source/devices_jandy.c
@@ -86,7 +86,8 @@ bool processJandyPacket(unsigned char *packet_buffer, int packet_length, struct
rtn = processPacketToSWG(packet_buffer, packet_length, aqdata/*, _aqconfig_.swg_zero_ignore*/);
previous_packet_to = packet_buffer[PKT_DEST];
}
- else if (READ_RSDEV_ePUMP && packet_buffer[PKT_DEST] >= JANDY_DEC_PUMP_MIN && packet_buffer[PKT_DEST] <= JANDY_DEC_PUMP_MAX)
+ else if (READ_RSDEV_ePUMP && ( (packet_buffer[PKT_DEST] >= JANDY_DEC_PUMP_MIN && packet_buffer[PKT_DEST] <= JANDY_DEC_PUMP_MAX)
+ || (packet_buffer[PKT_DEST] >= JANDY_DEC_PUMP2_MIN && packet_buffer[PKT_DEST] <= JANDY_DEC_PUMP2_MAX) ) )
{
interestedInNextAck = DRS_EPUMP;
rtn = processPacketToJandyPump(packet_buffer, packet_length, aqdata);
@@ -129,7 +130,7 @@ bool processPacketToSWG(unsigned char *packet, int packet_length, struct aqualin
//static int swg_zero_cnt = 0;
bool changedAnything = false;
- // Only log if we are jandy debug move and not serial (otherwise it'll print twice)
+ // Only log if we are jandy debug move and not serial (otherwise it'll print twice)
if (getLogLevel(DJAN_LOG) == LOG_DEBUG && getLogLevel(RSSD_LOG) < LOG_DEBUG ) {
char buff[1024];
beautifyPacket(buff, 1024, packet, packet_length, true);
@@ -164,8 +165,9 @@ bool processPacketToSWG(unsigned char *packet, int packet_length, struct aqualin
setSWGpercent(aqdata, (int)packet[4]);
changedAnything = true;
aqdata->updated = true;
- LOG(DJAN_LOG, LOG_DEBUG, "Set SWG %% to %d from control panel RS485 packet to SWG\n", aqdata->swg_percent);
+ LOG(DJAN_LOG, LOG_INFO, "Set SWG %% to %d from control panel to SWG\n", aqdata->swg_percent);
}
+
// LOG(DJAN_LOG, 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]);
/*}*/
@@ -212,7 +214,7 @@ bool processPacketFromSWG(unsigned char *packet, int packet_length, struct aqual
if ( (packet[4] * 100) != aqdata->swg_ppm ) {
aqdata->swg_ppm = packet[4] * 100;
- LOG(DJAN_LOG, LOG_DEBUG, "Set SWG PPM to %d from SWG packet\n", aqdata->swg_ppm);
+ LOG(DJAN_LOG, LOG_INFO, "Received SWG PPM %d from SWG packet\n", aqdata->swg_ppm);
changedAnything = true;
aqdata->updated = true;
}
@@ -571,9 +573,9 @@ bool processPacketToJandyPump(unsigned char *packet_buffer, int packet_length, s
// If type 0x45 and 0x44 set to interested in next command.
if (packet_buffer[3] == CMD_EPUMP_RPM) {
// All we need to do is set we are interested in next packet, but ca lling function already did this.
- LOG(DJAN_LOG, LOG_DEBUG, "ControlPanel request Pump ID 0x%02hhx set RPM to %d\n",packet_buffer[PKT_DEST], ( (packet_buffer[EP_HI_B_RPM-1] * 256) + packet_buffer[EP_LO_B_RPM-1]) / 4 );
+ LOG(DJAN_LOG, LOG_INFO, "ControlPanel request Pump ID 0x%02hhx set RPM to %d\n",packet_buffer[PKT_DEST], ( (packet_buffer[EP_HI_B_RPM-1] * 256) + packet_buffer[EP_LO_B_RPM-1]) / 4 );
} else if (packet_buffer[3] == CMD_EPUMP_WATTS) {
- LOG(DJAN_LOG, LOG_DEBUG, "ControlPanel request Pump ID 0x%02hhx get watts\n",packet_buffer[PKT_DEST]);
+ LOG(DJAN_LOG, LOG_INFO, "ControlPanel request Pump ID 0x%02hhx get watts\n",packet_buffer[PKT_DEST]);
}
if (getLogLevel(DJAN_LOG) == LOG_DEBUG) {
@@ -685,24 +687,24 @@ bool processPacketToJandyJXiHeater(unsigned char *packet_buffer, int packet_leng
*/
if (packet_buffer[5] != aqdata->pool_htr_set_point) {
- LOG(DJAN_LOG, LOG_DEBUG, "JXi pool setpoint %d, Pool heater sp %d (changing to LXi)\n", packet_buffer[5], aqdata->pool_htr_set_point);
+ LOG(DJAN_LOG, LOG_INFO, "JXi pool setpoint %d, Pool heater sp %d (changing to LXi)\n", packet_buffer[5], aqdata->pool_htr_set_point);
aqdata->pool_htr_set_point = packet_buffer[5];
}
if (packet_buffer[6] != aqdata->spa_htr_set_point) {
- LOG(DJAN_LOG, LOG_DEBUG, "JXi spa setpoint %d, Spa heater sp %d (changing to LXi)\n", packet_buffer[6], aqdata->spa_htr_set_point);
+ LOG(DJAN_LOG, LOG_INFO, "JXi spa setpoint %d, Spa heater sp %d (changing to LXi)\n", packet_buffer[6], aqdata->spa_htr_set_point);
aqdata->spa_htr_set_point = packet_buffer[6];
}
if (packet_buffer[7] != 0xff && packet_buffer[4] != 0x00) {
if (packet_buffer[4] == 0x11 || packet_buffer[4] == 0x19) {
if (aqdata->pool_temp != packet_buffer[7]) {
- LOG(DJAN_LOG, LOG_DEBUG, "JXi pool water temp %d, pool water temp %d (changing to LXi)\n", packet_buffer[7], aqdata->pool_temp);
+ LOG(DJAN_LOG, LOG_INFO, "JXi pool water temp %d, pool water temp %d (changing to LXi)\n", packet_buffer[7], aqdata->pool_temp);
aqdata->pool_temp = packet_buffer[7];
}
} else if (packet_buffer[4] == 0x12 || packet_buffer[4] == 0x1a) {
if (aqdata->spa_temp != packet_buffer[7]) {
- LOG(DJAN_LOG, LOG_DEBUG, "JXi spa water temp %d, spa water temp %d (changing to LXi)\n", packet_buffer[7], aqdata->spa_temp);
+ LOG(DJAN_LOG, LOG_INFO, "JXi spa water temp %d, spa water temp %d (changing to LXi)\n", packet_buffer[7], aqdata->spa_temp);
aqdata->spa_temp = packet_buffer[7];
}
}
diff --git a/source/devices_pentair.c b/source/devices_pentair.c
index c3bf455..ad22a0a 100644
--- a/source/devices_pentair.c
+++ b/source/devices_pentair.c
@@ -103,9 +103,9 @@ bool processPentairPacket(unsigned char *packet, int packet_length, struct aqual
// Set power to pump
else if (packet[PEN_PKT_CMD] == PEN_CMD_POWER && packet[PEN_PKT_DEST] >= PENTAIR_DEC_PUMP_MIN && packet[PEN_PKT_DEST] <= PENTAIR_DEC_PUMP_MAX) {
if (packet[9] == 0x0A) {
- LOG(DPEN_LOG, LOG_INFO,"Pentair Pump 0x%02hhx request set power ON\n");
+ LOG(DPEN_LOG, LOG_INFO,"Pentair Pump 0x%02hhx request set power ON\n",packet[PEN_PKT_DEST]);
} else {
- LOG(DPEN_LOG, LOG_INFO,"Pentair Pump 0x%02hhx request set power OFF\n");
+ LOG(DPEN_LOG, LOG_INFO,"Pentair Pump 0x%02hhx request set power OFF\n",packet[PEN_PKT_DEST]);
}
}
diff --git a/source/iaqtouch.c b/source/iaqtouch.c
index 057266e..bf1a81a 100644
--- a/source/iaqtouch.c
+++ b/source/iaqtouch.c
@@ -714,7 +714,7 @@ void debugPrintButtons(struct iaqt_page_button buttons[])
int i;
for (i=0; i < IAQ_PAGE_BUTTONS; i++) {
if (buttons[i].state != 0 || buttons[i].type != 0 || buttons[i].unknownByte != 0 || buttons[i].keycode != 0)
- LOG(IAQT_LOG,LOG_INFO, "Button %.2d| %21.21s | type=0x%02hhx | state=0x%02hhx | unknown=0x%02hhx | keycode=0x%02hhx\n",i,buttons[i].name,buttons[i].type,buttons[i].state,buttons[i].unknownByte,buttons[i].keycode);
+ LOG(IAQT_LOG,LOG_DEBUG, "Button %.2d| %21.21s | type=0x%02hhx | state=0x%02hhx | unknown=0x%02hhx | keycode=0x%02hhx\n",i,buttons[i].name,buttons[i].type,buttons[i].state,buttons[i].unknownByte,buttons[i].keycode);
}
}
@@ -891,7 +891,34 @@ bool process_iaqtouch_packet(unsigned char *packet, int length, struct aqualinkd
beautifyPacket(buff, 1024, packet, length, true);
LOG(IAQT_LOG,LOG_DEBUG, "Received message : %s", buff);
}*/
-
+
+ // DEBUG for iAqualink
+ if (_aqconfig_.enable_iaqualink) {
+ if (packet[PKT_CMD] == CMD_IAQ_AUX_STATUS) {
+ // Look at notes in iaqualink.c for how this packet is made up
+ int start=packet[4];
+ start = start + 5;
+ for (int i = start; i < length-3; i=i) {
+ int status=i;
+ int labelstart=status+5;
+ int labellen=packet[status+4];
+ if (labelstart+labellen < length) {
+ LOG(IAQT_LOG,LOG_NOTICE, "Label %.*s = %s, bit1=0x%02hhx bit2=0x%02hhx bit3=0x%02hhx bit4=0x%02hhx\n", labellen, &packet[labelstart], (packet[status]==0x00?"Off":"On "), packet[status],packet[status+1],packet[status+2],packet[status+3]);
+ }
+ i = labelstart + labellen;
+ }
+
+ LOG(IAQT_LOG,LOG_NOTICE, "Pump %s, Spa %s, SWG %d, PumpRPM %d, PoolSP=%d, SpaSP=%d\n",
+ aq_data->aqbuttons[0].led->state==OFF?"Off":"On ",
+ aq_data->aqbuttons[1].led->state==OFF?"Off":"On ",
+ aq_data->swg_percent,
+ aq_data->pumps[0].rpm,
+ aq_data->pool_htr_set_point,
+ aq_data->spa_htr_set_point);
+ }
+
+
+ }
if (packet[PKT_CMD] == CMD_IAQ_PAGE_START) {
// Reset and messages on new page
diff --git a/source/iaqualink.c b/source/iaqualink.c
index e62e982..51a6d21 100644
--- a/source/iaqualink.c
+++ b/source/iaqualink.c
@@ -2,8 +2,8 @@
* Copyright (c) 2017 Shaun Feakes - All rights reserved
*
* You may use redistribute and/or modify this code under the terms of
- * the GNU General Public License version 2 as published by the
- * Free Software Foundation. For the terms of this license,
+ * the GNU General Public License version 2 as published by the
+ * Free Software Foundation. For the terms of this license,
* see .
*
* You are free to use this software under the terms of the GNU General
@@ -21,11 +21,193 @@
#include "aq_serial.h"
#include "aqualink.h"
#include "packetLogger.h"
+#include "aq_serial.h"
+#include "serialadapter.h"
bool process_iaqualink_packet(unsigned char *packet, int length, struct aqualinkdata *aq_data)
{
- //debuglogPacket(IAQL_LOG, packet, length, true, true);
+ // debuglogPacket(IAQL_LOG, packet, length, true, true);
return true;
-}
\ No newline at end of file
+}
+
+// This is onle here temporarly until we figure out the protocol.
+void send_iaqualink_ack(int rs_fd, unsigned char *packet_buffer)
+{
+ /*
+ Probe | HEX: 0x10|0x02|0xa3|0x00|0xb5|0x10|0x03|
+ Ack | HEX: 0x10|0x02|0x00|0x01|0x00|0x00|0x13|0x10|0x03|
+ Unknown '0x61' | HEX: 0x10|0x02|0xa3|0x61|0x00|0x00|0x00|0x04|0x00|0x27|0x41|0x10|0x03|
+ Ack | HEX: 0x10|0x02|0x00|0x01|0x61|0x00|0x74|0x10|0x03|
+ Unknown '0x50' | HEX: 0x10|0x02|0xa3|0x50|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x00|0x25|0x10|0x03|
+ Ack | HEX: 0x10|0x02|0x00|0x01|0x50|0x00|0x63|0x10|0x03|
+ Unknown '0x51' | HEX: 0x10|0x02|0xa3|0x51|0x00|0x06|0x10|0x03|
+ Ack | HEX: 0x10|0x02|0x00|0x01|0x51|0x00|0x64|0x10|0x03|
+ Unknown '0x59' | HEX: 0x10|0x02|0xa3|0x59|0x00|0x0e|0x10|0x03|
+ Ack | HEX: 0x10|0x02|0x00|0x01|0x59|0x00|0x6c|0x10|0x03|
+ Unknown '0x52' | HEX: 0x10|0x02|0xa3|0x52|0x00|0x07|0x10|0x03|
+ Ack | HEX: 0x10|0x02|0x00|0x01|0x52|0x00|0x65|0x10|0x03|
+ Unknown '0x53' | HEX: 0x10|0x02|0xa3|0x53|0x08|0x10|0x03|
+ Ack | HEX: 0x10|0x02|0x00|0x01|0x3f|0x00|0x52|0x10|0x03|
+ Use byte 3 as return ack, except for 0x53=0x3f
+ */
+ if (packet_buffer[PKT_CMD] == CMD_PROBE) {
+ LOG(IAQL_LOG,LOG_NOTICE, "Got probe on '0x%02hhx' 2nd iAqualink Protocol\n",packet_buffer[PKT_DEST]);
+ send_extended_ack(rs_fd, packet_buffer[PKT_CMD], 0x00);
+ }
+ else if (packet_buffer[PKT_CMD] == 0x53)
+ {
+ static int cnt = 0;
+ /*
+ if (cnt == 10)
+ {
+ cnt = 5;
+ LOG(IAQL_LOG, LOG_NOTICE, "Sent accept pButton\n");
+ send_extended_ack(rs_fd, 0x3f, 0x20);
+ }*/
+ if (cnt++ > 20)
+ {
+ cnt = 0;
+ LOG(IAQL_LOG, LOG_NOTICE, "Sending get bigass packet\n");
+ send_extended_ack(rs_fd, 0x3f, 0x18);
+ }
+ else
+ {
+ // Use 0x3f
+ send_extended_ack(rs_fd, 0x3f, 0x00);
+ }
+ //send_jandy_command(rs_fd, get_rssa_cmd(packet_buffer[PKT_CMD]), 4);
+ }
+ else if (packet_buffer[PKT_CMD] == 0x73)
+ {
+ static int id=33;
+ // unsigned char pb1[] = {PCOL_JANDY,0x10,0x02,0x00,0x24,0x73,0x01,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc2,0x10,0x03,0x00};
+ // unsigned char pb2[] = {PCOL_JANDY,0x10,0x02,0x00,0x24,0x73,0x01,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xcb,0x10,0x03,0x00};
+ // 0x21 turns on filter_pump and aux 1
+ unsigned char pb3[] = {0x00, 0x24, 0x73, 0x01, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+
+ pb3[4] = id++;
+
+ LOG(IAQL_LOG, LOG_NOTICE, "Sent pButton dec=%d hex=0x%02hhx\n",pb3[4],pb3[4]);
+ // send_packet(rs_fd, pb2, 25);
+ send_jandy_command(rs_fd, pb3, 19);
+ }
+ else
+ {
+ // Use packet_buffer[PKT_CMD]
+ send_extended_ack(rs_fd, packet_buffer[PKT_CMD], 0x00);
+ }
+}
+
+/*
+
+Send command 0x18 to 0xa1 returns below to 0x31. Looks like status
+
+Filter pump does not effect the below.
+Heater on/off does not effect below.
+HEater setpoints does not effect.
+Only Aux on/off seem to effect the status.
+
+4th bit tells you where to start,
+ after start 4 bits are status
+ last bit of status tell you chars in label.
+ after label repeat start 4 bits.
+
+For Aux1 10th bit 0=off 1=on 11 to 14 15 to 19=name
+ Aux2 19th
+ Aux3 28
+ Aux4 37
+
+In Below Aux 3 color light / Aux 4 dimmer / Aux 5 color light (different type to aux3)
+
+Aux 1 off / Aux 3 on
+ HEX: 0x10|0x02|0x31|0x72|0x05|0x01|0x02|0x03|0x04|0x05|0x00|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x31|0x01|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x32|0x01|0x07|0x02|0x03|0x04|0x41|0x75|0x78|0x33|0x00|0x01|0x01|0x00|0x04|0x41|0x75|0x78|0x34|0x00|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x35|0xd5|0x10|0x03|
+Dec | 16| 2| 49| 114| 5| 1| 2| 3| 4| 5| 0| 1| 0| 0| 4| 65| 117| 120| 49| 1| 1| 0| 0| 4| 65| 117| 120| 50| 1| 7| 2| 3| 4| 65| 117| 120| 51| 0| 1| 1| 0| 4| 65| 117| 120| 52| 0| 1| 0| 0| 4| 65| 117| 120| 53| 213| 16| 3
+Ascii | | | 1| r| | | | | | | | | | | | A| u| x| 1| | | | | | A| u| x| 2| | | | | | A| u| x| 3| | | | | | A| u| x| 4| | | | | | A| u| x| 5| | |
+
+Aux 1 on / Aux 3 on
+| HEX: 0x10|0x02|0x31|0x72|0x05|0x01|0x02|0x03|0x04|0x05|0x01|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x31|0x01|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x32|0x01|0x07|0x02|0x03|0x04|0x41|0x75|0x78|0x33|0x00|0x01|0x01|0x00|0x04|0x41|0x75|0x78|0x34|0x00|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x35|0xd6|0x10|0x03|
+Dec | 16| 2| 49| 114| 5| 1| 2| 3| 4| 5| 1| 1| 0| 0| 4| 65| 117| 120| 49| 1| 1| 0| 0| 4| 65| 117| 120| 50| 1| 7| 2| 3| 4| 65| 117| 120| 51| 0| 1| 1| 0| 4| 65| 117| 120| 52| 0| 1| 0| 0| 4| 65| 117| 120| 53| 214| 16| 3
+Ascii | | | 1| r| | | | | | | | | | | | A| u| x| 1| | | | | | A| u| x| 2| | | | | | A| u| x| 3| | | | | | A| u| x| 4| | | | | | A| u| x| 5| | |
+
+Aux 1 off Aux3 to different light color
+Hex |0x10|0x02|0x31|0x72|0x05|0x01|0x02|0x03|0x04|0x05|0x00|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x31|0x01|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x32|0x00|0x07|0x02|0x03|0x04|0x41|0x75|0x78|0x33|0x00|0x01|0x01|0x00|0x04|0x41|0x75|0x78|0x34|0x00|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x35|0xd4|0x10|0x03|
+Dec | 16| 2| 49| 114| 5| 1| 2| 3| 4| 5| 0| 1| 0| 0| 4| 65| 117| 120| 49| 1| 1| 0| 0| 4| 65| 117| 120| 50| 0| 7| 2| 3| 4| 65| 117| 120| 51| 0| 1| 1| 0| 4| 65| 117| 120| 52| 0| 1| 0| 0| 4| 65| 117| 120| 53| 212| 16| 3
+Ascii | | | 1| r| | | | | | | | | | | | A| u| x| 1| | | | | | A| u| x| 2| | | | | | A| u| x| 3| | | | | | A| u| x| 4| | | | | | A| u| x| 5| | |
+
+
+
+RS16 panel.
+ HEX: 0x10|0x02|0x31|0x72|0x0f|0x01|0x02|0x03|0x04|0x05|0x06|0x07|0x08|0x09|0x0a|0x0b|0x0c|0x0d|0x0e|0x0f|0x00|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x31|0x01|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x32|0x01|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x33|0x01|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x34|0x01|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x35|0x01|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x36|0x01|0x01|0x00|0x00|0x04|0x41|0x75|0x78|0x37|0x01|0x01|0x00|0x00|0x06|0x41|0x75|0x78|0x20|0x42|0x31|0x01|0x01|0x00|0x00|0x06|0x41|0x75|0x78|0x20|0x42|0x32|0x01|0x01|0x00|0x00|0x06|0x41|0x75|0x78|0x20|0x42|0x33|0x01|0x01|0x00|0x00|0x06|0x41|0x75|0x78|0x20|0x42|0x34|0x01|0x01|0x00|0x00|0x06|0x41|0x75|0x78|0x20|0x42|0x35|0x01|0x01|0x00|0x00|0x06|0x41|0x75|0x78|0x20|0x42|0x36|0x01|0x01|0x00|0x00|0x06|0x41|0x75|0x78|0x20|0x42|0x37|0x01|0x01|0x00|0x00|0x06|0x41|0x75|0x78|0x20|0x42|0x38|0x77|0x10|0x03|
+Dec | 16| 2| 49| 114| 15| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 0| 1| 0| 0| 4| 65| 117| 120| 49| 1| 1| 0| 0| 4| 65| 117| 120| 50| 1| 1| 0| 0| 4| 65| 117| 120| 51| 1| 1| 0| 0| 4| 65| 117| 120| 52| 1| 1| 0| 0| 4| 65| 117| 120| 53| 1| 1| 0| 0| 4| 65| 117| 120| 54| 1| 1| 0| 0| 4| 65| 117| 120| 55| 1| 1| 0| 0| 6| 65| 117| 120| 32| 66| 49| 1| 1| 0| 0| 6| 65| 117| 120| 32| 66| 50| 1| 1| 0| 0| 6| 65| 117| 120| 32| 66| 51| 1| 1| 0| 0| 6| 65| 117| 120| 32| 66| 52| 1| 1| 0| 0| 6| 65| 117| 120| 32| 66| 53| 1| 1| 0| 0| 6| 65| 117| 120| 32| 66| 54| 1| 1| 0| 0| 6| 65| 117| 120| 32| 66| 55| 1| 1| 0| 0| 6| 65| 117| 120| 32| 66| 56| 119| 16| 3
+Ascii | | | 1| r| | | | | | | | | | | | | | | | | | | | | | A| u| x| 1| | | | | | A| u| x| 2| | | | | | A| u| x| 3| | | | | | A| u| x| 4| | | | | | A| u| x| 5| | | | | | A| u| x| 6| | | | | | A| u| x| 7| | | | | | A| u| x| | B| 1| | | | | | A| u| x| | B| 2| | | | | | A| u| x| | B| 3| | | | | | A| u| x| | B| 4| | | | | | A| u| x| | B| 5| | | | | | A| u| x| | B| 6| | | | | | A| u| x| | B| 7| | | | | | A| u| x| | B| 8| w| |
+
+Hex |0x10|0x02|0x31|0x72|
+
+*/
+
+/* Startup sequences
+
+RS16 combo
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Probe | HEX: 0x10|0x02|0xa1|0x00|0xb3|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x00|0x00|0x13|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Unknown '0x61' | HEX: 0x10|0x02|0xa1|0x61|0x00|0x00|0x00|0x01|0x00|0x1d|0x32|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x61|0x00|0x74|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Unknown '0x50' | HEX: 0x10|0x02|0xa1|0x50|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x00|0x23|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x50|0x00|0x63|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Unknown '0x51' | HEX: 0x10|0x02|0xa1|0x51|0x31|0x42|0x41|0x36|0x32|0x38|0x32|0x35|0x42|0x37|0x43|0x36|0x39|0x41|0x34|0x43|0x00|0xa2|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x51|0x00|0x64|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Unknown '0x59' | HEX: 0x10|0x02|0xa1|0x59|0x00|0x0c|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x59|0x00|0x6c|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Unknown '0x52' | HEX: 0x10|0x02|0xa1|0x52|0x00|0x05|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x52|0x00|0x65|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type iAqalnk Poll | HEX: 0x10|0x02|0xa1|0x53|0x06|0x10|0x03|
+
+RS8 Combo rev T.2
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Probe | HEX: 0x10|0x02|0xa1|0x00|0xb3|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x00|0x00|0x13|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Unknown '0x61' | HEX: 0x10|0x02|0xa1|0x61|0x00|0x00|0x00|0x01|0x00|0x1d|0x32|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x61|0x00|0x74|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Unknown '0x50' | HEX: 0x10|0x02|0xa1|0x50|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x00|0x23|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x50|0x00|0x63|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Unknown '0x51' | HEX: 0x10|0x02|0xa1|0x51|0x31|0x42|0x41|0x36|0x32|0x38|0x32|0x35|0x42|0x37|0x43|0x36|0x39|0x41|0x34|0x43|0x00|0xa2|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x51|0x00|0x64|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Unknown '0x59' | HEX: 0x10|0x02|0xa1|0x59|0x00|0x0c|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x59|0x00|0x6c|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Unknown '0x52' | HEX: 0x10|0x02|0xa1|0x52|0x00|0x05|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x52|0x00|0x65|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type iAqalnk Poll | HEX: 0x10|0x02|0xa1|0x53|0x06|0x10|0x03|
+
+RS4 rev Yg
+Notice: Serial Log:Read Jandy packet To 0xa3 of type Probe | HEX: 0x10|0x02|0xa3|0x00|0xb5|0x10|0x03|
+Notice: Serial Log:Read Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x00|0x00|0x13|0x10|0x03|
+Notice: Serial Log:Read Jandy packet To 0xa3 of type Unknown '0x61' | HEX: 0x10|0x02|0xa3|0x61|0x00|0x00|0x00|0x04|0x00|0x27|0x41|0x10|0x03|
+Notice: Serial Log:Read Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x61|0x00|0x74|0x10|0x03|
+Notice: Serial Log:Read Jandy packet To 0xa3 of type Unknown '0x50' | HEX: 0x10|0x02|0xa3|0x50|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x00|0x25|0x10|0x03|
+Notice: Serial Log:Read Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x50|0x00|0x63|0x10|0x03|
+Notice: Serial Log:Read Jandy packet To 0xa3 of type Unknown '0x51' | HEX: 0x10|0x02|0xa3|0x51|0x00|0x06|0x10|0x03|
+Notice: Serial Log:Read Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x51|0x00|0x64|0x10|0x03|
+Notice: Serial Log:Read Jandy packet To 0xa3 of type Unknown '0x59' | HEX: 0x10|0x02|0xa3|0x59|0x00|0x0e|0x10|0x03|
+Notice: Serial Log:Read Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x59|0x00|0x6c|0x10|0x03|
+Notice: Serial Log:Read Jandy packet To 0xa3 of type Unknown '0x52' | HEX: 0x10|0x02|0xa3|0x52|0x00|0x07|0x10|0x03|
+Notice: Serial Log:Read Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x52|0x00|0x65|0x10|0x03|
+Notice: Serial Log:Read Jandy packet To 0xa3 of type Unknown '0x53' | HEX: 0x10|0x02|0xa3|0x53|0x08|0x10|0x03|
+Notice: Serial Log:Read Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x3f|0x00|0x52|0x10|0x03|
+
+RS6 rev T2 RS8 (home)
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Probe | HEX: 0x10|0x02|0xa1|0x00|0xb3|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x00|0x00|0x13|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Unknown '0x61' | HEX: 0x10|0x02|0xa1|0x61|0x00|0x00|0x00|0x01|0x00|0x1d|0x32|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x61|0x00|0x74|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Unknown '0x50' | HEX: 0x10|0x02|0xa1|0x50|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x20|0x00|0x23|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x50|0x00|0x63|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Unknown '0x51' | HEX: 0x10|0x02|0xa1|0x51|0x31|0x42|0x41|0x36|0x32|0x38|0x32|0x35|0x42|0x37|0x43|0x36|0x39|0x41|0x34|0x43|0x00|0xa2|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x51|0x00|0x64|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Unknown '0x59' | HEX: 0x10|0x02|0xa1|0x59|0x01|0x0d|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x59|0x00|0x6c|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type Unknown '0x52' | HEX: 0x10|0x02|0xa1|0x52|0x03|0x08|0x10|0x03|
+Debug: RS Serial: Write Jandy packet To 0x00 of type Ack | HEX: 0x10|0x02|0x00|0x01|0x52|0x00|0x65|0x10|0x03|
+Debug: RS Serial: Read Jandy packet To 0xa1 of type iAqalnk Poll | HEX: 0x10|0x02|0xa1|0x53|0x06|0x10|0x03|
+*/
diff --git a/source/iaqualink.h b/source/iaqualink.h
index e255549..740284b 100644
--- a/source/iaqualink.h
+++ b/source/iaqualink.h
@@ -1,8 +1,60 @@
+void send_iaqualink_ack(int rs_fd, unsigned char *packet_buffer);
+
bool process_iaqualink_packet(unsigned char *packet, int length, struct aqualinkdata *aq_data);
+
+// Send the below commands to turn on/off (toggle)
+// This is the button in pButton. (byte 6 in below)
+// iAq pButton | HEX: 0x10|0x02|0x00|0x24|0x73|0x01|0x21|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0x00|0xcb|0x10|0x03|
+
+#define IAQ_PUMP 0x00
+#define IAQ_POOL_HTR 0x01
+#define IAQ_SPA 0x02
+#define IAQ_SPA_HTR 0x03
+//....... some missing ....
+#define IAQ_AUX1 0x21
+#define IAQ_AUX2 0x22
+#define IAQ_AUX3 0x23
+#define IAQ_AUX4 0x24
+#define IAQ_AUX5 0x25
+#define IAQ_AUX6 0x26
+#define IAQ_AUX7 0x27
+#define IAQ_AUXB1 0x28
+#define IAQ_AUXB2 0x29
+#define IAQ_AUXB3 0x2a
+#define IAQ_AUXB4 0x2b
+#define IAQ_AUXB5 0x2c
+#define IAQ_AUXB6 0x2d
+#define IAQ_AUXB7 0x2e
+#define IAQ_AUXB8 0x2f
+//... Looks like there are C & D buttons
+/* I got this when sending dec=53 hex=0x35 as the button, all of a sudden got extra buttons in the aux status message send to AqualinkTouch protocol
+ Not sure on ordering BUT dec=57 hex=0x39 = button D2 / dec=58 hex=0x3a = D3
+Notice: iAQ Touch: Label Aux C1 = On
+Notice: iAQ Touch: Label Aux C2 = Off
+Notice: iAQ Touch: Label Aux C3 = Off
+Notice: iAQ Touch: Label Aux C4 = Off
+Notice: iAQ Touch: Label Aux C5 = Off
+Notice: iAQ Touch: Label Aux C6 = On
+Notice: iAQ Touch: Label Aux C7 = On
+Notice: iAQ Touch: Label Aux C8 = On
+Notice: iAQ Touch: Label Aux D1 = On
+Notice: iAQ Touch: Label Aux D2 = On
+Notice: iAQ Touch: Label Aux D3 = On
+Notice: iAQ Touch: Label Aux D4 = On
+Notice: iAQ Touch: Label Aux D5 = On
+Notice: iAQ Touch: Label Aux D6 = On
+Notice: iAQ Touch: Label Aux D7 = On
+Notice: iAQ Touch: Label Aux D8 = On
+*/
+//... Need to add Vitrual buttons...
+
+
+
+
/*
Read Jandy packet To 0xa3 of type Unknown '0x53' | HEX: 0x10|0x02|0xa3|0x53|0x08|0x10|0x03|
diff --git a/source/json_messages.c b/source/json_messages.c
index 2f0693b..c8dafa3 100644
--- a/source/json_messages.c
+++ b/source/json_messages.c
@@ -503,7 +503,14 @@ int logmaskjsonobject(logmask_t flag, char* buffer)
int length = sprintf(buffer, "{\"name\":\"%s\",\"id\":\"%d\",\"set\":\"%s\"},", logmask2name(flag), flag,(isDebugLogMaskSet(flag)?JSON_ON:JSON_OFF));
if (flag == RSSD_LOG) {
- length = sprintf(buffer, "{\"name\":\"%s\",\"id\":\"%d\",\"set\":\"%s\",\"filter\":\"0x%02hhx\"},", logmask2name(flag), flag,(isDebugLogMaskSet(flag)?JSON_ON:JSON_OFF), _aqconfig_.RSSD_LOG_filter);
+ //length = sprintf(buffer, "{\"name\":\"%s\",\"id\":\"%d\",\"set\":\"%s\",\"filter\":\"0x%02hhx\"},", logmask2name(flag), flag,(isDebugLogMaskSet(flag)?JSON_ON:JSON_OFF), _aqconfig_.RSSD_LOG_filter[0]);
+ length = sprintf(buffer, "{\"name\":\"%s\",\"id\":\"%d\",\"set\":\"%s\",\"filters\":[", logmask2name(flag), flag,(isDebugLogMaskSet(flag)?JSON_ON:JSON_OFF));
+ for (int i=0; i < MAX_RSSD_LOG_FILTERS; i++) {
+ length += sprintf(buffer+length, "\"0x%02hhx\",", _aqconfig_.RSSD_LOG_filter[i]);
+ }
+ //"]},"
+ length += sprintf(buffer+length-1, "]},");
+ length--;
}
return length;
}
diff --git a/source/net_services.c b/source/net_services.c
index 4130f25..1acc485 100644
--- a/source/net_services.c
+++ b/source/net_services.c
@@ -1077,8 +1077,17 @@ uriAtype action_URI(request_source from, const char *URI, int uri_length, float
if ( round(value) == RSSD_LOG ) {
// Check for filter on RSSD LOG
if (ri2 != NULL) {
- _aqconfig_.RSSD_LOG_filter = strtoul(cleanalloc(ri2), NULL, 16);
- LOG(NET_LOG,LOG_NOTICE, "Adding RSSD LOG filter 0x%02hhx", _aqconfig_.RSSD_LOG_filter);
+ unsigned int n;
+ // ri will be /addlogmask/0x01 0x02 0x03 0x04/
+ for (int i=0; i < MAX_RSSD_LOG_FILTERS; i++) {
+ int index=i*5;
+ if (ri2[index]=='0' && ri2[index+1]=='x') {
+ sscanf(&ri2[index], "0x%2x", &n);
+ _aqconfig_.RSSD_LOG_filter[i] = n;
+ //_aqconfig_.RSSD_LOG_filter_OLD = strtoul(cleanalloc(ri2), NULL, 16);
+ LOG(NET_LOG,LOG_NOTICE, "Adding RSSD LOG filter 0x%02hhx", _aqconfig_.RSSD_LOG_filter[i]);
+ }
+ }
}
}
addDebugLogMask(round(value));
@@ -1086,8 +1095,11 @@ uriAtype action_URI(request_source from, const char *URI, int uri_length, float
} else if (strncmp(ri1, "removelogmask", 13) == 0 && from == NET_WS) { // Only valid from websocket.
removeDebugLogMask(round(value));
if ( round(value) == RSSD_LOG ) {
- _aqconfig_.RSSD_LOG_filter = NUL;
- LOG(NET_LOG,LOG_NOTICE, "Removed RSSD LOG filter");
+ for (int i=0; i < MAX_RSSD_LOG_FILTERS; i++) {
+ _aqconfig_.RSSD_LOG_filter[i] = NUL;
+ }
+ //_aqconfig_.RSSD_LOG_filter_OLD = NUL;
+ //LOG(NET_LOG,LOG_NOTICE, "Removed RSSD LOG filter");
}
return uAQmanager; // Want to resent updated status
} else if (strncmp(ri1, "logfile", 7) == 0) {
diff --git a/source/packetLogger.c b/source/packetLogger.c
index cdf805a..f795c4d 100644
--- a/source/packetLogger.c
+++ b/source/packetLogger.c
@@ -93,6 +93,15 @@ void debuglogPacket(logmask_t from, unsigned char *packet_buffer, int packet_len
_logPacket(from, packet_buffer, packet_length, false, forcelog, is_read);
}
+bool RSSD_LOG_filter_match(unsigned char ID) {
+ for (int i=0; i < MAX_RSSD_LOG_FILTERS; i++) {
+ if (_aqconfig_.RSSD_LOG_filter[i] != NUL && _aqconfig_.RSSD_LOG_filter[i] == ID) {
+ return true;
+ }
+ }
+ return false;
+}
+
void _logPacket(logmask_t from, unsigned char *packet_buffer, int packet_length, bool error, bool force, bool is_read)
{
static unsigned char lastPacketTo = NUL;
@@ -107,10 +116,12 @@ void _logPacket(logmask_t from, unsigned char *packet_buffer, int packet_length,
}
- if ( _aqconfig_.RSSD_LOG_filter != NUL ) {
+ if ( _aqconfig_.RSSD_LOG_filter[0] != NUL ) {
// NOTE Whole IF statment is reversed
- if ( ! ( (_aqconfig_.RSSD_LOG_filter == packet_buffer[PKT_DEST]) ||
- ( packet_buffer[PKT_DEST] == 0x00 && lastPacketTo == _aqconfig_.RSSD_LOG_filter)) )
+ //if ( ! ( (_aqconfig_.RSSD_LOG_filter_OLD == packet_buffer[PKT_DEST]) ||
+ // ( packet_buffer[PKT_DEST] == 0x00 && lastPacketTo == _aqconfig_.RSSD_LOG_filter_OLD)) )
+ if ( ! ( (RSSD_LOG_filter_match(packet_buffer[PKT_DEST])) ||
+ ( packet_buffer[PKT_DEST] == 0x00 && RSSD_LOG_filter_match(lastPacketTo) )) )
{
lastPacketTo = packet_buffer[PKT_DEST];
return;
diff --git a/source/serialadapter.c b/source/serialadapter.c
index ef3242e..e8fc472 100644
--- a/source/serialadapter.c
+++ b/source/serialadapter.c
@@ -9,6 +9,7 @@
#include "serialadapter.h"
#include "packetLogger.h"
#include "color_lights.h"
+#include "allbutton.h"
#define RSSA_QLEN 20
@@ -33,6 +34,14 @@ unsigned char getAux14[] = {0x00,0x01,0x00,RS_SA_AUX14};
unsigned char getAux15[] = {0x00,0x01,0x00,RS_SA_AUX15};
#endif
+// processLEDstate exists in allbutton.c
+//void processLEDstate(struct aqualinkdata *aq_data, unsigned char *packet, logmask_t from);
+void processRSSALEDstate(struct aqualinkdata *aq_data, unsigned char *packet)
+{
+ processLEDstate(aq_data, packet, RSSA_LOG);
+}
+
+
bool push_rssa_cmd(unsigned char *cmd) {
if (_rssa_q_length >= RSSA_QLEN ) {
@@ -285,12 +294,12 @@ bool process_rssadapter_packet(unsigned char *packet, int length, struct aqualin
LOG(RSSA_LOG,LOG_DEBUG, "Probe received, will queue device update shortly\n");
//queueGetProgramData(RSSADAPTER, aq_data);
cnt=-5; // Connection reset, so queue the status update
- /*
+
} else if (packet[PKT_CMD] == CMD_STATUS) {
// This is identical to allbutton status packet.
- LOG(RSSA_LOG,LOG_DEBUG, "RS Received STATUS length %d.\n", length);
- debuglogPacket(RSSA_LOG, packet, length, true, true);
- */
+ //LOG(RSSA_LOG,LOG_DEBUG, "RS Received STATUS length %d.\n", length);
+ //debuglogPacket(RSSA_LOG, packet, length, true, true);
+ processRSSALEDstate(aq_data, packet);
} else if (packet[PKT_CMD] == 0x13) {
//beautifyPacket(buff, packet, length);
//LOG(RSSA_LOG,LOG_DEBUG, "%s", buff);
diff --git a/source/utils.c b/source/utils.c
index f7faf71..70d2f7e 100644
--- a/source/utils.c
+++ b/source/utils.c
@@ -335,7 +335,7 @@ const char* logmask2name(logmask_t from)
return "Serial Log:";
break;
case IAQL_LOG:
- return "iAqualink :";
+ return "iAqualink: ";
break;
case AQUA_LOG:
default:
diff --git a/web/aqmanager.html b/web/aqmanager.html
index 7c99173..9647177 100644
--- a/web/aqmanager.html
+++ b/web/aqmanager.html
@@ -572,11 +572,19 @@
element = document.createElement('div');
element.style.marginTop = '1px';
element.style.marginBottom = '2px'; // = 'style="margin-left: 5px';
- element.innerHTML = ' RS Serial Filter ID (Eg 0x10)';
+ element.innerHTML = ' RS Serial Filter (Eg 0x10 0x0a)';
eCommands.appendChild(element);
- if (data['debugmasks'][obj].filter != "0x00"){
- //var filter = document.getElementById("rssd_filter").value;
- document.getElementById("rssd_filter").value = data['debugmasks'][obj].filter;
+ var filterentry = document.getElementById("rssd_filter");
+ filterentry.value = "";
+ for (var id in data['debugmasks'][obj].filters) {
+ console.log("Filter "+data['debugmasks'][obj].filters[id]);
+ if (data['debugmasks'][obj].filters[id] != "0x00") {
+ if (filterentry.value.length == 0) {
+ filterentry.value = data['debugmasks'][obj].filters[id];
+ } else {
+ filterentry.value = filterentry.value+" "+data['debugmasks'][obj].filters[id];
+ }
+ }
}
}
}
diff --git a/web/hk/Extra_Aux-off.png b/web/hk/Extra_Aux-off.png
new file mode 120000
index 0000000..5f60636
--- /dev/null
+++ b/web/hk/Extra_Aux-off.png
@@ -0,0 +1 @@
+./switch-off.png
\ No newline at end of file
diff --git a/web/hk/Extra_Aux-on.png b/web/hk/Extra_Aux-on.png
new file mode 120000
index 0000000..6afbc0b
--- /dev/null
+++ b/web/hk/Extra_Aux-on.png
@@ -0,0 +1 @@
+./switch-on.png
\ No newline at end of file
diff --git a/web/hk/switch-on-new.png b/web/hk/switch-on-new.png
new file mode 100644
index 0000000..5b3b609
Binary files /dev/null and b/web/hk/switch-on-new.png differ