mirror of https://github.com/sfeakes/AqualinkD.git
Update for 2.6.0 (dev 0.2)
parent
2e6140aa67
commit
d203927d12
|
@ -129,11 +129,14 @@ NEED TO FIX FOR THIS RELEASE.
|
|||
|
||||
|
||||
* Check SWG messages like "#1 TruClear", see log in this post https://github.com/sfeakes/AqualinkD/discussions/388
|
||||
|
||||
* Finish off heat pump / chiller. Probably use a thermostat for both with heat going to heater SP can cool to chiller SP
|
||||
-->
|
||||
|
||||
|
||||
# Updates in 2.6.0 (dev)
|
||||
* Added configuration editor in aqmanager.
|
||||
* Can now self-configure on startup.
|
||||
* Added scheduling of pump after events (Power On, Freeze Protect, Boost)
|
||||
* Fixed HA bug for thermostats not converting to °C when HA is set to display °C.
|
||||
* Added support for monitoring SBC system sensors, like CPU / GPU / Board (CPU temp being most useful).
|
||||
|
@ -142,6 +145,7 @@ NEED TO FIX FOR THIS RELEASE.
|
|||
* Reworked PDA sleep mode.
|
||||
* Added preliminary Heat Pump / Chiller support (MQTT & HA support only, no Homekit or web ui yet)
|
||||
|
||||
|
||||
# Updates in 2.5.0
|
||||
* PDA panel Rev 6.0 or newer that do not have a Jandy iAqualink device attached can use the AqualinkTouch protocol rather than PDA protocol.
|
||||
* This is faster, more reliable and does not intefear with the physical PDA device (like existing implimentation)
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -63,7 +63,7 @@ panel_type = RS-8 Combo
|
|||
# Working RS ID's are 0x0a 0x0b 0x09 0x08 <- 0x08 is usually taken
|
||||
# If your panel is a PDA only model, then PDA device ID's are 0x60, 0x61, 0x62, 0x63.
|
||||
# (These are NOT recomended to use unless you absolutly have no other option)
|
||||
device_id=0x00
|
||||
device_id=0xFF
|
||||
|
||||
|
||||
# The ID of Jandy SerialInterface device. These is only one usable ID, if serial_logger
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -439,6 +439,11 @@ void _processMessage(char *message, struct aqualinkdata *aq_data, bool reset)
|
|||
//freeze_msg_count = 0;
|
||||
strcpy(aq_data->last_display_message, msg); // Also display the message on web UI
|
||||
}
|
||||
|
||||
else if (ENABLE_CHILLER && (stristr(msg,"Chiller") != NULL || stristr(msg,"Heat Pump") != NULL)) {
|
||||
processHeatPumpDisplayMessage(msg, aq_data); // This doesn;t exist yet
|
||||
}
|
||||
|
||||
/* // Not sure when to do with these for the moment, so no need to compile in the test.
|
||||
else if (stristr(msg, LNG_MSG_CHEM_FEED_ON) != NULL) {
|
||||
}
|
||||
|
|
|
@ -346,27 +346,28 @@ aqkey *addVirtualButton(struct aqualinkdata *aqdata, char *label, int vindex) {
|
|||
if (aqdata->total_buttons + 1 >= TOTAL_BUTTONS) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int index = vindex;
|
||||
|
||||
// vindex 0 means find first index.
|
||||
if (vindex == 0) {
|
||||
printf(" TOTAL=%d VSTART=%d\n",aqdata->total_buttons,aqdata->virtual_button_start);
|
||||
index = aqdata->total_buttons - aqdata->virtual_button_start + 1;
|
||||
}
|
||||
|
||||
if (aqdata->virtual_button_start <= 0) {
|
||||
aqdata->virtual_button_start = aqdata->total_buttons;
|
||||
}
|
||||
aqkey *button = &aqdata->aqbuttons[aqdata->total_buttons++];
|
||||
|
||||
//aqdata->aqbuttons[index].led = ;
|
||||
//aqdata->aqbuttons[index].led->state = LED_S_UNKNOWN;
|
||||
//aqdata->aqbuttons[index].label = // copy label;
|
||||
//aqdata->aqbuttons[index].name = // aux_v?; ? is vindex
|
||||
//aqdata->aqbuttons[index].code = NUL;
|
||||
//aqdata->aqbuttons[index].dz_idx = DZ_NULL_IDX;
|
||||
//aqdata->aqbuttons[index].special_mask = 0;
|
||||
|
||||
//aqled *led = malloc(sizeof(aqled));
|
||||
//button->led = led;
|
||||
|
||||
button->led = malloc(sizeof(aqled));
|
||||
|
||||
char *name = malloc(sizeof(char*) * 10);
|
||||
snprintf(name, 9, "%s%d", BTN_VAUX, vindex);
|
||||
button->name = name;
|
||||
snprintf(name, 9, "%s%d", BTN_VAUX, index);
|
||||
button->name = name;
|
||||
|
||||
button->special_mask_ptr = malloc(sizeof(vbutton_detail));
|
||||
((vbutton_detail *)button->special_mask_ptr)->altlabel = NUL;
|
||||
|
||||
if (label == NULL || strlen(label) <= 0) {
|
||||
//button->label = name;
|
||||
|
@ -374,28 +375,11 @@ aqkey *addVirtualButton(struct aqualinkdata *aqdata, char *label, int vindex) {
|
|||
} else {
|
||||
setVirtualButtonLabel(button, label);
|
||||
}
|
||||
/*
|
||||
if (strlen(label) <= 0) {
|
||||
button->label = name;
|
||||
} else {
|
||||
button->label = label;
|
||||
}
|
||||
// These 3 vbuttons have a button code on iaqualink protocol, so use that for rssd_code.
|
||||
if (strncasecmp (button->label, "ALL OFF", 7) == 0) {
|
||||
button->rssd_code = IAQ_ALL_OFF;
|
||||
} else if (strncasecmp (button->label, "Spa Mode", 8) == 0) {
|
||||
button->rssd_code = IAQ_SPA_MODE;
|
||||
} else if (strncasecmp (button->label, "Clean Mode", 10) == 0) {
|
||||
button->rssd_code = IAQ_CLEAN_MODE;
|
||||
} else if (strncasecmp (button->label, "Day Party", 9) == 0) {
|
||||
button->rssd_code = IAQ_ONETOUCH_4;
|
||||
} else {
|
||||
button->rssd_code = NUL;
|
||||
}*/
|
||||
|
||||
button->code = NUL;
|
||||
button->dz_idx = DZ_NULL_IDX;
|
||||
button->special_mask |= VIRTUAL_BUTTON; // Could change to special mask vbutton
|
||||
button->led->state = OFF;
|
||||
|
||||
return button;
|
||||
}
|
||||
|
@ -420,6 +404,17 @@ bool setVirtualButtonLabel(aqkey *button, const char *label) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool setVirtualButtonAltLabel(aqkey *button, const char *label) {
|
||||
if (label == NULL )
|
||||
return false;
|
||||
|
||||
((vbutton_detail *)button->special_mask_ptr)->altlabel = (char *)label;
|
||||
((vbutton_detail *)button->special_mask_ptr)->in_alt_mode = false;
|
||||
button->special_mask |= VIRTUAL_BUTTON_ALT_LABEL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// So the 0-100% should be 600-3450 RPM and 15-130 GPM (ie 1% would = 600 & 0%=off)
|
||||
// (value-600) / (3450-600) * 100
|
||||
// (value) / 100 * (3450-600) + 600
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#define RSP_IAQT (1 << 13) // 128
|
||||
#define RSP_RSSA (1 << 14) // 128
|
||||
#define RSP_EXT_PROG (1 << 15) // 128
|
||||
|
||||
// ....Remeber no more for int16_t.......
|
||||
|
||||
// Bitmask for pannel support against board rev
|
||||
// used in getPanelSupport()
|
||||
|
@ -75,6 +75,7 @@ uint16_t getPanelSupport( char *rev_string, int rev_len);
|
|||
|
||||
aqkey *addVirtualButton(struct aqualinkdata *aqdata, char *label, int vindex);
|
||||
bool setVirtualButtonLabel(aqkey *button, const char *label);
|
||||
bool setVirtualButtonAltLabel(aqkey *button, const char *label);
|
||||
|
||||
clight_detail *getProgramableLight(struct aqualinkdata *aqdata, int button);
|
||||
pump_detail *getPumpDetail(struct aqualinkdata *aqdata, int button);
|
||||
|
@ -94,8 +95,10 @@ pump_detail *getPumpDetail(struct aqualinkdata *aqdata, int button);
|
|||
#define isIAQL_ACTIVE ((_aqconfig_.extended_device_id2 != NUL))
|
||||
|
||||
#define isVS_PUMP(mask) ((mask & VS_PUMP) == VS_PUMP)
|
||||
#define isVBUTTON(mask) ((mask & VIRTUAL_BUTTON) == VIRTUAL_BUTTON)
|
||||
#define isPLIGHT(mask) ((mask & PROGRAM_LIGHT) == PROGRAM_LIGHT)
|
||||
#define isVBUTTON(mask) ((mask & VIRTUAL_BUTTON) == VIRTUAL_BUTTON)
|
||||
#define isVBUTTON_ALTLABEL(mask) ((mask & VIRTUAL_BUTTON_ALT_LABEL) == VIRTUAL_BUTTON_ALT_LABEL)
|
||||
#define isVBUTTON_CHILLER(mask) ((mask & VIRTUAL_BUTTON_CHILLER) == VIRTUAL_BUTTON_CHILLER)
|
||||
|
||||
int PANEL_SIZE();
|
||||
//
|
||||
|
@ -115,6 +118,7 @@ int PANEL_SIZE();
|
|||
// If we need to increase virtual buttons, then increase below.
|
||||
|
||||
// NEED TO FIX, IF WE CHANGE TO ANOTHING OTHER THAN 0 CORE DUMP (we also had "panel_type = RS-16 Combo" in config)
|
||||
// FIX IS PROBABLY MAKE SURE LEDS IS SAME OR MORE.
|
||||
#define VIRTUAL_BUTTONS 0
|
||||
|
||||
#ifndef AQ_RS16
|
||||
|
|
|
@ -263,6 +263,10 @@ void queueGetProgramData(emulation_type source_type, struct aqualinkdata *aq_dat
|
|||
} else if (source_type == IAQTOUCH && isEXTP_ENABLED) {
|
||||
//_aq_programmer(AQ_GET_IAQTOUCH_FREEZEPROTECT, NULL, aq_data, false); // Add back and remove below once tested and working
|
||||
//_aq_programmer(AQ_GET_IAQTOUCH_SETPOINTS, NULL, aq_data, false); // This get's freeze & heaters, we should just get freeze if isRSSA_ENABLED
|
||||
if (ENABLE_CHILLER) {
|
||||
// Need to get setpoints for chiller.
|
||||
_aq_programmer(AQ_GET_IAQTOUCH_SETPOINTS, NULL, aq_data, false);
|
||||
}
|
||||
} else if (source_type == ALLBUTTON) {
|
||||
_aq_programmer(AQ_GET_FREEZE_PROTECT_TEMP, NULL, aq_data, false); // This is still quicker that IAQ or ONE Touch protocols at the moment.
|
||||
if (_aqconfig_.use_panel_aux_labels) {
|
||||
|
|
|
@ -107,6 +107,9 @@ typedef struct aqualinkkey
|
|||
#define TIMER_ACTIVE (1 << 2)
|
||||
//#define DIMMER_LIGHT (1 << 3) // NOT USED (Use PROGRAM_LIGHT or type LC_DIMMER)
|
||||
#define VIRTUAL_BUTTON (1 << 4)
|
||||
// Below are types of VIRT_BUTTON, SO VIRT_BUTTON must also be set
|
||||
#define VIRTUAL_BUTTON_ALT_LABEL (1 << 5)
|
||||
#define VIRTUAL_BUTTON_CHILLER (1 << 6)
|
||||
//typedef struct ProgramThread ProgramThread; // Definition is later
|
||||
|
||||
struct programmingthread {
|
||||
|
@ -195,6 +198,16 @@ typedef enum panel_vsp_status
|
|||
|
||||
#define PUMP_NAME_LENGTH 30
|
||||
|
||||
// Overall Status of Aqualinkd
|
||||
/*
|
||||
#define CONNECTED ( 1<< 0 ) // All is good (every other mask should be cleared)
|
||||
#define NOT_CONNECTED ( 1 << 2 ) // Serial Error maybe renaem
|
||||
#define AUTOCONFIGURE_ID ( 1 << 3 )
|
||||
#define AUTOCONFIGURE_PANEL ( 1 << 4 )
|
||||
#define CONNECTING ( 1 << 5 )
|
||||
#define ERROR_. // maybe covered in NOT_CONNECTED
|
||||
*/
|
||||
|
||||
typedef struct pumpd
|
||||
{
|
||||
int rpm;
|
||||
|
@ -236,6 +249,20 @@ typedef enum clight_type {
|
|||
NUMBER_LIGHT_COLOR_TYPES // This is used to size and count so add more prior to this
|
||||
} clight_type;
|
||||
|
||||
/*
|
||||
typedef enum {
|
||||
MD_CHILLER,
|
||||
MD_HEATPUMP
|
||||
} heatmump_mode;
|
||||
*/
|
||||
typedef struct vbuttond
|
||||
{
|
||||
char *altlabel;
|
||||
bool in_alt_mode; // Example if altlabel="chiller", if last seen was chiller message this is true.
|
||||
//heatmump_mode chiller_mode;
|
||||
// Add any other special params for virtual button
|
||||
} vbutton_detail;
|
||||
|
||||
typedef enum {
|
||||
NET_MQTT=0,
|
||||
NET_API,
|
||||
|
@ -245,6 +272,8 @@ typedef enum {
|
|||
UNACTION_TIMER
|
||||
} request_source;
|
||||
|
||||
|
||||
|
||||
typedef struct clightd
|
||||
{
|
||||
clight_type lightType;
|
||||
|
@ -284,12 +313,14 @@ struct aqualinkdata
|
|||
int swg_percent;
|
||||
int swg_ppm;
|
||||
int chiller_set_point;
|
||||
aqkey *chiller_button;
|
||||
//heatmump_mode chiller_mode;
|
||||
unsigned char ar_swg_device_status; // Actual state
|
||||
unsigned char heater_err_status;
|
||||
aqledstate swg_led_state; // Display state for UI's
|
||||
aqledstate service_mode_state;
|
||||
aqledstate frz_protect_state;
|
||||
aqledstate chiller_state;
|
||||
//aqledstate chiller_state;
|
||||
int num_pumps;
|
||||
pump_detail pumps[MAX_PUMPS];
|
||||
int num_lights;
|
||||
|
|
|
@ -811,7 +811,7 @@ int startup(char *self, char *cfgFile)
|
|||
|
||||
// Sanity check on Device ID's against panel type
|
||||
if (isRS_PANEL) {
|
||||
if ( (_aqconfig_.device_id >= 0x08 && _aqconfig_.device_id <= 0x0B) || _aqconfig_.device_id == 0x00 /*|| _aqconfig_.device_id == 0xFF*/) {
|
||||
if ( (_aqconfig_.device_id >= 0x08 && _aqconfig_.device_id <= 0x0B) || _aqconfig_.device_id == 0x00 || _aqconfig_.device_id == 0xFF) {
|
||||
// We are good
|
||||
} else {
|
||||
LOG(AQUA_LOG,LOG_ERR, "Device ID 0x%02hhx does not match RS panel, Going to search for ID!\n", _aqconfig_.device_id);
|
||||
|
@ -970,6 +970,103 @@ void caculate_ack_packet(int rs_fd, unsigned char *packet_buffer, emulation_type
|
|||
|
||||
}
|
||||
|
||||
bool auto_configure(unsigned char* packet) {
|
||||
// Loop over PROBE packets and store any we can use,
|
||||
// once we see the 2nd probe of any ID we fave stored, then the loop is complete,
|
||||
// set ID's and exit true, exit falce to get called again.
|
||||
/*
|
||||
unsigned char _goodID[] = {0x0a, 0x0b, 0x08, 0x09};
|
||||
unsigned char _goodPDAID[] = {0x60, 0x61, 0x62, 0x63}; // PDA Panel only supports one PDA.
|
||||
unsigned char _goodONETID[] = {0x40, 0x41, 0x42, 0x43};
|
||||
unsigned char _goodIAQTID[] = {0x30, 0x31, 0x32, 0x33};
|
||||
unsigned char _goodRSSAID[] = {0x48, 0x49}; // Know there are only 2 good RS SA id's, guess 0x49 is the second.
|
||||
*/
|
||||
|
||||
static unsigned char firstprobe = 0x00;
|
||||
static unsigned char lastID = 0x00;
|
||||
static bool seen_iAqualink2 = false;
|
||||
static int foundIDs = 0;
|
||||
|
||||
if ( packet[PKT_CMD] == CMD_PROBE ) {
|
||||
LOG(AQUA_LOG,LOG_INFO, "Got Probe on ID 0x%02hhx\n",packet[PKT_DEST]);
|
||||
//printf(" *** Got Probe on ID 0x%02hhx\n",packet[PKT_DEST]);
|
||||
}
|
||||
|
||||
if (lastID != 0x00 && packet[PKT_DEST] == DEV_MASTER ) { // Can't use got a reply to the late probe.
|
||||
lastID = 0x00;
|
||||
} else if (lastID != 0x00 && packet[PKT_DEST] != DEV_MASTER) {
|
||||
// We can use last ID.
|
||||
// Save the first good ID.
|
||||
if (firstprobe == 0x00 && lastID != 0x60) {
|
||||
// NOTE IF can't use 0x60 (or PDA ID's) for probe, as they are way too often.
|
||||
//printf("*** First Probe 0x%02hhx\n",lastID);
|
||||
firstprobe = lastID;
|
||||
_aqconfig_.device_id = 0x00;
|
||||
_aqconfig_.rssa_device_id = 0x00;
|
||||
_aqconfig_.extended_device_id = 0x00;
|
||||
}
|
||||
|
||||
|
||||
if ( (lastID >= 0x08 && lastID <= 0x0B) &&
|
||||
(_aqconfig_.device_id == 0x00 || _aqconfig_.device_id == 0xFF) ) {
|
||||
_aqconfig_.device_id = lastID;
|
||||
LOG(AQUA_LOG,LOG_NOTICE, "Found valid unused device ID 0x%02hhx\n",lastID);
|
||||
foundIDs++;
|
||||
} else if ( (lastID >= 0x48 && lastID <= 0x49) &&
|
||||
(_aqconfig_.rssa_device_id == 0x00 || _aqconfig_.rssa_device_id == 0xFF) ) {
|
||||
_aqconfig_.rssa_device_id = lastID;
|
||||
LOG(AQUA_LOG,LOG_NOTICE, "Found valid unused RSSA ID 0x%02hhx\n",lastID);
|
||||
foundIDs++;
|
||||
} else if ( (lastID >= 0x40 && lastID <= 0x43) &&
|
||||
(_aqconfig_.extended_device_id == 0x00 || _aqconfig_.extended_device_id == 0xFF) ) {
|
||||
_aqconfig_.extended_device_id = lastID;
|
||||
_aqconfig_.extended_device_id_programming = true;
|
||||
// Don't increase foundIDs as we prefer not to use this one.
|
||||
LOG(AQUA_LOG,LOG_NOTICE, "Found valid unused extended ID 0x%02hhx\n",lastID);
|
||||
} else if ( (lastID >= 0x30 && lastID <= 0x33) &&
|
||||
(_aqconfig_.extended_device_id < 0x30 || _aqconfig_.extended_device_id > 0x33)) { //Overide is it's been set to Touch or not set.
|
||||
_aqconfig_.extended_device_id = lastID;
|
||||
_aqconfig_.extended_device_id_programming = true;
|
||||
if (!seen_iAqualink2) {
|
||||
_aqconfig_.enable_iaqualink = true;
|
||||
_aqconfig_.read_RS485_devmask &= ~ READ_RS485_IAQUALNK; // Remove this mask, as no need since we enabled iaqualink
|
||||
}
|
||||
LOG(AQUA_LOG,LOG_NOTICE, "Found valid unused extended ID 0x%02hhx\n",lastID);
|
||||
foundIDs++;
|
||||
}
|
||||
// Now reset ID
|
||||
lastID = 0x00;
|
||||
}
|
||||
|
||||
if ( foundIDs >= 3 || (packet[PKT_DEST] == firstprobe && packet[PKT_CMD] == CMD_PROBE) ) {
|
||||
// We should have seen one complete probe cycle my now.
|
||||
LOG(AQUA_LOG,LOG_NOTICE, "Finished Autoconfigure using device_id=0x%02hhx rssa_device_id=0x%02hhx extended_device_id=0x%02hhx (%s iAqualink2/3)\n",
|
||||
_aqconfig_.device_id,_aqconfig_.rssa_device_id,_aqconfig_.extended_device_id, _aqconfig_.enable_iaqualink?"Enable":"Disable");
|
||||
return true; // we can exit finally.
|
||||
}
|
||||
|
||||
if ( (packet[PKT_CMD] == CMD_PROBE) && (
|
||||
(packet[PKT_DEST] >= 0x08 && packet[PKT_DEST] <= 0x0B) ||
|
||||
//(packet[PKT_DEST] >= 0x60 && packet[PKT_DEST] <= 0x63) ||
|
||||
(packet[PKT_DEST] >= 0x40 && packet[PKT_DEST] <= 0x43) ||
|
||||
(packet[PKT_DEST] >= 0x30 && packet[PKT_DEST] <= 0x33) ||
|
||||
(packet[PKT_DEST] >= 0x48 && packet[PKT_DEST] <= 0x49) ))
|
||||
{
|
||||
lastID = packet[PKT_DEST]; // Store the valid ID.
|
||||
} else if (lastID != 0x00 && packet[PKT_CMD] != CMD_PROBE &&
|
||||
(packet[PKT_DEST] >= 0xA0 && packet[PKT_DEST] <= 0xA3) ) // we get a packet to iAqualink2/3 make sure to turn off
|
||||
{ // Saw a iAqualink2/3 device, so can't use ID, but set to read device info.
|
||||
// LOG Nessage as such
|
||||
_aqconfig_.extended_device_id2 = 0x00;
|
||||
_aqconfig_.enable_iaqualink = false;
|
||||
_aqconfig_.read_RS485_devmask |= READ_RS485_IAQUALNK;
|
||||
seen_iAqualink2 = true;
|
||||
LOG(AQUA_LOG,LOG_NOTICE, "Saw inuse iAqualink2/3 ID 0x%02hhx, turning off AqualinkD on that ID\n",lastID);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned char find_unused_address(unsigned char* packet) {
|
||||
static int ID[4] = {0,0,0,0}; // 0=0x08, 1=0x09, 2=0x0A, 3=0x0B
|
||||
static unsigned char lastID = 0x00;
|
||||
|
@ -1006,6 +1103,7 @@ void main_loop()
|
|||
bool got_probe_rssa = false;
|
||||
bool print_once = false;
|
||||
int blank_read_reconnect = MAX_ZERO_READ_BEFORE_RECONNECT_BLOCKING; // Will get reset if non blocking
|
||||
bool auto_config_complete = true;
|
||||
|
||||
_aqualink_data.panelstatus = STARTING;
|
||||
sprintf(_aqualink_data.last_display_message, "%s", "Connecting to Control Panel");
|
||||
|
@ -1019,7 +1117,7 @@ void main_loop()
|
|||
_aqualink_data.pool_htr_set_point = TEMP_UNKNOWN;
|
||||
_aqualink_data.spa_htr_set_point = TEMP_UNKNOWN;
|
||||
_aqualink_data.chiller_set_point = TEMP_UNKNOWN;
|
||||
_aqualink_data.chiller_state = LED_S_UNKNOWN;
|
||||
//_aqualink_data.chiller_state = LED_S_UNKNOWN;
|
||||
_aqualink_data.unactioned.type = NO_ACTION;
|
||||
_aqualink_data.swg_percent = TEMP_UNKNOWN;
|
||||
_aqualink_data.swg_ppm = TEMP_UNKNOWN;
|
||||
|
@ -1173,14 +1271,20 @@ void main_loop()
|
|||
got_probe_rssa = true;
|
||||
|
||||
if (_aqconfig_.device_id == 0x00) {
|
||||
LOG(AQUA_LOG,LOG_WARNING, "Searching for valid ID, please configure `device_id` for faster startup\n");
|
||||
LOG(AQUA_LOG,LOG_WARNING, "Searching for valid ID, please configure `device_id` for faster startup");
|
||||
}
|
||||
|
||||
LOG(AQUA_LOG,LOG_NOTICE, "Waiting for Control Panel probe\n");
|
||||
if (_aqconfig_.device_id == 0xFF) {
|
||||
LOG(AQUA_LOG,LOG_NOTICE, "Waiting for Control Panel information\n\n");
|
||||
LOG(AQUA_LOG,LOG_WARNING, "Unsing Auto configure, this will take some time, (make sure to undate aqualinkd configuration to speed up startup!)\n");
|
||||
auto_config_complete = false;
|
||||
} else {
|
||||
LOG(AQUA_LOG,LOG_NOTICE, "Waiting for Control Panel probe\n");
|
||||
}
|
||||
i=0;
|
||||
|
||||
// Loop until we get the probe messages, that means we didn;t start too soon after last shutdown.
|
||||
while ( (got_probe == false || got_probe_rssa == false || got_probe_extended == false ) && _keepRunning == true && _cmdln_nostartupcheck == false)
|
||||
while ( (got_probe == false || got_probe_rssa == false || got_probe_extended == false || auto_config_complete == false) && _keepRunning == true && _cmdln_nostartupcheck == false)
|
||||
{
|
||||
if (blank_read == blank_read_reconnect / 2) {
|
||||
LOG(AQUA_LOG,LOG_ERR, "Nothing read on '%s', are you sure that's right?\n",_aqconfig_.serial_port);
|
||||
|
@ -1207,6 +1311,16 @@ void main_loop()
|
|||
*/
|
||||
packet_length = get_packet(rs_fd, packet_buffer);
|
||||
|
||||
if (packet_length > 0 && auto_config_complete == false) {
|
||||
blank_read = 0;
|
||||
auto_config_complete = auto_configure(packet_buffer);
|
||||
if (auto_config_complete) {
|
||||
got_probe = true;
|
||||
got_probe_rssa = true;
|
||||
got_probe_extended = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (packet_length > 0 && _aqconfig_.device_id == 0x00) {
|
||||
blank_read = 0;
|
||||
_aqconfig_.device_id = find_unused_address(packet_buffer);
|
||||
|
|
417
source/config.c
417
source/config.c
|
@ -165,7 +165,7 @@ const int _dcfg_light_programming_initial_off = 12;
|
|||
|
||||
void init_parameters (struct aqconfig * parms)
|
||||
{
|
||||
#ifdef CONFIG_DEV_TEST
|
||||
//#ifdef CONFIG_DEV_TEST
|
||||
_numCfgParams = 0;
|
||||
|
||||
const int unknownInt = TEMP_UNKNOWN;
|
||||
|
@ -173,14 +173,16 @@ void init_parameters (struct aqconfig * parms)
|
|||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.socket_port;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_STRING;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_socket_port;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = (void *)_dcfg_web_port;
|
||||
|
||||
_numCfgParams++;
|
||||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.serial_port;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_STRING;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_serial_port;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = (void *)_dcfg_serial_port;
|
||||
|
||||
_numCfgParams++;
|
||||
|
@ -237,7 +239,8 @@ void init_parameters (struct aqconfig * parms)
|
|||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.web_directory;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_STRING;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_web_directory;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = NULL;
|
||||
|
||||
#ifndef AQ_MANAGER
|
||||
|
@ -245,7 +248,8 @@ void init_parameters (struct aqconfig * parms)
|
|||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.log_file;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_STRING;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_log_file;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = NULL;
|
||||
#endif
|
||||
|
||||
|
@ -302,14 +306,16 @@ void init_parameters (struct aqconfig * parms)
|
|||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.mqtt_dz_sub_topic;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_STRING;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_mqtt_dz_sub_topic;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = NULL;
|
||||
|
||||
_numCfgParams++;
|
||||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.mqtt_dz_pub_topic;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_STRING;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_mqtt_dz_pub_topic;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = NULL;
|
||||
/*
|
||||
_numCfgParams++;
|
||||
|
@ -323,70 +329,80 @@ void init_parameters (struct aqconfig * parms)
|
|||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.dzidx_air_temp;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_INT;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_dzidx_air_temp;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = (void *)&unknownInt;
|
||||
|
||||
_numCfgParams++;
|
||||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.dzidx_pool_water_temp;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_INT;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_dzidx_pool_water_temp;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = (void *)&unknownInt;
|
||||
|
||||
_numCfgParams++;
|
||||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.dzidx_spa_water_temp;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_INT;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_dzidx_spa_water_temp;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = (void *)&unknownInt;
|
||||
|
||||
_numCfgParams++;
|
||||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.dzidx_swg_percent;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_INT;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_dzidx_swg_percent;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = (void *)&unknownInt;
|
||||
|
||||
_numCfgParams++;
|
||||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.dzidx_swg_ppm;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_INT;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_dzidx_swg_ppm;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = (void *)&unknownInt;
|
||||
|
||||
_numCfgParams++;
|
||||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.dzidx_swg_status;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_INT;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_dzidx_swg_status;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = (void *)&unknownInt;
|
||||
|
||||
_numCfgParams++;
|
||||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.convert_dz_temp;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_BOOL;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_convert_dz_temp;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = (void *)&unknownInt;
|
||||
|
||||
_numCfgParams++;
|
||||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.light_programming_mode;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_FLOAT;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_light_programming_mode;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = (void *)&_dcfg_light_programming_mode;
|
||||
|
||||
_numCfgParams++;
|
||||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.light_programming_initial_on;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_INT;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_light_programming_initial_on;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = (void *)&_dcfg_light_programming_initial_on;
|
||||
|
||||
_numCfgParams++;
|
||||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.light_programming_initial_off;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_INT;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_light_programming_initial_off;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = (void *)&_dcfg_light_programming_initial_off;
|
||||
|
||||
_numCfgParams++;
|
||||
|
@ -549,7 +565,8 @@ void init_parameters (struct aqconfig * parms)
|
|||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.display_warnings_web;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_BOOL;
|
||||
_cfgParams[_numCfgParams].name = "display_warnings_in_web";
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = (void *)&_dcfg_true;
|
||||
|
||||
_numCfgParams++;
|
||||
|
@ -562,14 +579,16 @@ void init_parameters (struct aqconfig * parms)
|
|||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.report_zero_spa_temp;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_BOOL;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_report_zero_spa_temp;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = (void *)&_dcfg_true;
|
||||
|
||||
_numCfgParams++;
|
||||
_cfgParams[_numCfgParams].value_ptr = &_aqconfig_.report_zero_pool_temp;
|
||||
_cfgParams[_numCfgParams].value_type = CFG_BOOL;
|
||||
_cfgParams[_numCfgParams].name = CFG_N_report_zero_pool_temp;
|
||||
_cfgParams[_numCfgParams].advanced = true;
|
||||
//_cfgParams[_numCfgParams].advanced = true;
|
||||
_cfgParams[_numCfgParams].config_mask |= CFG_GRP_ADVANCED;
|
||||
_cfgParams[_numCfgParams].default_value = (void *)&_dcfg_true;
|
||||
|
||||
#ifdef AQ_PDA
|
||||
|
@ -580,7 +599,7 @@ void init_parameters (struct aqconfig * parms)
|
|||
_cfgParams[_numCfgParams].default_value = (void *)&_dcfg_true;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
// Default to daemonize
|
||||
parms->deamonize = true;
|
||||
|
@ -898,7 +917,7 @@ bool setConfigValue(struct aqualinkdata *aqdata, char *param, char *value) {
|
|||
char *tmpval;
|
||||
|
||||
|
||||
#ifdef CONFIG_DEV_TEST
|
||||
//#ifdef CONFIG_DEV_TEST
|
||||
//int val;
|
||||
//char *sval;
|
||||
for (int i=0; i <= _numCfgParams; i++) {
|
||||
|
@ -972,7 +991,7 @@ bool setConfigValue(struct aqualinkdata *aqdata, char *param, char *value) {
|
|||
|
||||
//LOG(AQUA_LOG,LOG_ERR, "Missing cfg for %s\n",param);
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
if (strlen(cleanwhitespace(value)) <= 0) {
|
||||
LOG(AQUA_LOG,LOG_WARNING,"Configuration value is blank for option `%s`, Ignoring\n",param );
|
||||
|
@ -1081,301 +1100,6 @@ if (strlen(cleanwhitespace(value)) <= 0) {
|
|||
_aqconfig_.sched_chk_pumpoff_hour = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
|
||||
|
||||
#ifndef CONFIG_DEV_TEST
|
||||
// Below should be deleted once complete
|
||||
} else if (strncasecmp(param, CFG_N_socket_port, CFG_C_socket_port) == 0) {
|
||||
_aqconfig_.socket_port = cleanalloc(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_serial_port, CFG_C_serial_port) == 0) {
|
||||
_aqconfig_.serial_port = cleanalloc(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_log_level, CFG_C_log_level) == 0) {
|
||||
_aqconfig_.log_level = text2elevel(cleanalloc(value));
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_device_id, CFG_C_device_id) == 0) {
|
||||
_aqconfig_.device_id = strtoul(cleanalloc(value), NULL, 16);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_rssa_device_id, CFG_C_rssa_device_id) == 0) {
|
||||
_aqconfig_.rssa_device_id = strtoul(cleanalloc(value), NULL, 16);
|
||||
rtn=true;
|
||||
|
||||
#if defined AQ_ONETOUCH || defined AQ_IAQTOUCH
|
||||
} else if (strncasecmp (param, CFG_N_extended_device_id_programming, CFG_C_extended_device_id_programming) == 0) {
|
||||
// Has to be before the below.
|
||||
_aqconfig_.extended_device_id_programming = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_extended_device_id, CFG_C_extended_device_id) == 0) {
|
||||
_aqconfig_.extended_device_id = strtoul(cleanalloc(value), NULL, 16);
|
||||
// Enable enable_iaqualink by default and let people turn it off
|
||||
//if (_aqconfig_.extended_device_id >= JANDY_DEV_AQLNK_MIN && _aqconfig_.extended_device_id <= JANDY_DEV_AQLNK_MAX) {
|
||||
// _aqconfig_.enable_iaqualink = true;
|
||||
//}
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_enable_iaqualink, CFG_C_enable_iaqualink) == 0) {
|
||||
_aqconfig_.enable_iaqualink = text2bool(value);
|
||||
_aqconfig_.read_RS485_devmask &= ~READ_RS485_IAQUALNK; // This should not be set if we are reading dieectly so turn off mask
|
||||
rtn=true;
|
||||
#endif
|
||||
|
||||
} else if (strncasecmp(param, "rs_panel_size", 13) == 0) {
|
||||
LOG(AQUA_LOG,LOG_WARNING, "Config error, 'rs_panel_size' no longer supported, please use 'panel_type'\n");
|
||||
_defaultPanel.size = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_web_directory, CFG_C_web_directory) == 0) {
|
||||
_aqconfig_.web_directory = cleanalloc(value);
|
||||
rtn=true;
|
||||
#ifndef AQ_MANAGER
|
||||
} else if (strncasecmp(param, CFG_N_log_file, CFG_C_log_file) == 0) {
|
||||
_aqconfig_.log_file = cleanalloc(value);
|
||||
rtn=true;
|
||||
#endif
|
||||
} else if (strncasecmp(param, CFG_N_mqtt_server, CFG_C_mqtt_server) == 0) {
|
||||
_aqconfig_.mqtt_server = cleanalloc(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_mqtt_dz_sub_topic, CFG_C_mqtt_dz_sub_topic) == 0) {
|
||||
_aqconfig_.mqtt_dz_sub_topic = cleanalloc(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_mqtt_dz_pub_topic, CFG_C_mqtt_dz_pub_topic) == 0) {
|
||||
_aqconfig_.mqtt_dz_pub_topic = cleanalloc(value);
|
||||
rtn=true;
|
||||
|
||||
/* It might also make sence to also set these to true. Since aqualinkd does not know the state at the time discover topics are published.
|
||||
_aqconfig_.force_swg;
|
||||
_aqconfig_.force_ps_setpoints;
|
||||
_aqconfig_.force_frzprotect_setpoints;
|
||||
force_chem_feeder
|
||||
*/
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_mqtt_aq_topic, CFG_C_mqtt_aq_topic) == 0) {
|
||||
_aqconfig_.mqtt_aq_topic = cleanalloc(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_mqtt_user, CFG_C_mqtt_user) == 0) {
|
||||
_aqconfig_.mqtt_user = cleanalloc(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_mqtt_passwd, CFG_C_mqtt_passwd) == 0) {
|
||||
_aqconfig_.mqtt_passwd = cleanalloc(value);
|
||||
rtn=true;
|
||||
} else if ((strncasecmp(param, CFG_N_mqtt_hass_discover_use_mac, CFG_C_mqtt_hass_discover_use_mac) == 0) ||
|
||||
(strncasecmp(param, "mqtt_hassio_discover_use_mac", 28) == 0) ||
|
||||
(strncasecmp(param, "mqtt_hass_discover_use_mac", 26) == 0)) {
|
||||
_aqconfig_.mqtt_hass_discover_use_mac = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_dzidx_air_temp, CFG_C_dzidx_air_temp) == 0) {
|
||||
_aqconfig_.dzidx_air_temp = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_dzidx_pool_water_temp, CFG_C_dzidx_pool_water_temp) == 0) {
|
||||
_aqconfig_.dzidx_pool_water_temp = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_dzidx_spa_water_temp, CFG_C_dzidx_spa_water_temp) == 0) {
|
||||
_aqconfig_.dzidx_spa_water_temp = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_dzidx_swg_percent, CFG_C_dzidx_swg_percent) == 0) {
|
||||
_aqconfig_.dzidx_swg_percent = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_dzidx_swg_ppm, CFG_C_dzidx_swg_ppm) == 0) {
|
||||
_aqconfig_.dzidx_swg_ppm = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_dzidx_swg_status, CFG_C_dzidx_swg_status) == 0) {
|
||||
_aqconfig_.dzidx_swg_status = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_light_programming_mode, CFG_C_light_programming_mode) == 0) {
|
||||
_aqconfig_.light_programming_mode = atof(cleanalloc(value)); // should free this
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_light_programming_initial_on, CFG_C_light_programming_initial_on) == 0) {
|
||||
_aqconfig_.light_programming_initial_on = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_light_programming_initial_off, CFG_C_light_programming_initial_off) == 0) {
|
||||
_aqconfig_.light_programming_initial_off = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
/*
|
||||
} else if (strncasecmp(param, "light_programming_button_spa", 28) == 0) {
|
||||
LOG(AQUA_LOG,LOG_ERR, "Config error, 'light_programming_button_spa' no longer supported\n");
|
||||
//_aqconfig_.light_programming_button_spa = strtoul(value, NULL, 10) - 1;
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, "light_programming_button", 24) == 0 ||
|
||||
strncasecmp(param, "light_programming_button_pool", 29) == 0) {
|
||||
LOG(AQUA_LOG,LOG_ERR, "Config error, 'light_programming_button' & 'light_programming_button_pool' are no longer supported\n");
|
||||
//_aqconfig_.light_programming_button_pool = strtoul(value, NULL, 10) - 1;
|
||||
rtn=true;
|
||||
*/
|
||||
} else if (strncasecmp(param, CFG_N_override_freeze_protect, CFG_C_override_freeze_protect) == 0) {
|
||||
_aqconfig_.override_freeze_protect = text2bool(value);
|
||||
rtn=true;
|
||||
#ifdef AQ_PDA
|
||||
} else if (strncasecmp(param, CFG_N_pda_sleep_mode, CFG_C_pda_sleep_mode) == 0) {
|
||||
_aqconfig_.pda_sleep_mode = text2bool(value);
|
||||
rtn=true;
|
||||
#endif
|
||||
} else if (strncasecmp(param, CFG_N_convert_mqtt_temp, CFG_C_convert_mqtt_temp) == 0) {
|
||||
_aqconfig_.convert_mqtt_temp = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp(param, CFG_N_convert_dz_temp, CFG_C_convert_dz_temp) == 0) {
|
||||
_aqconfig_.convert_dz_temp = text2bool(value);
|
||||
rtn=true;
|
||||
/*
|
||||
} else if (strncasecmp(param, "flash_mqtt_buttons", 18) == 0) {
|
||||
_aqconfig_.flash_mqtt_buttons = text2bool(value);
|
||||
rtn=true;*/
|
||||
} else if (strncasecmp(param, CFG_N_report_zero_spa_temp, CFG_C_report_zero_spa_temp) == 0) {
|
||||
_aqconfig_.report_zero_spa_temp = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_report_zero_pool_temp, CFG_C_report_zero_pool_temp) == 0) {
|
||||
_aqconfig_.report_zero_pool_temp = text2bool(value);
|
||||
rtn=true;
|
||||
/*
|
||||
} else if (strncasecmp (param, "read_all_devices", 16) == 0) {
|
||||
LOG(AQUA_LOG,LOG_WARNING, "Config error, 'read_all_devices' is no longer supported, please using one or all of 'read_RS485_swg','read_RS485_ePump','read_RS485_vsfPump'\n");
|
||||
if (text2bool(value)) {
|
||||
_aqconfig_.read_RS485_devmask |= READ_RS485_SWG;
|
||||
_aqconfig_.read_RS485_devmask |= READ_RS485_JAN_PUMP;
|
||||
} else {
|
||||
_aqconfig_.read_RS485_devmask &= ~READ_RS485_SWG;
|
||||
_aqconfig_.read_RS485_devmask &= ~READ_RS485_JAN_PUMP;
|
||||
}
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, "read_pentair_packets", 17) == 0) {
|
||||
LOG(AQUA_LOG,LOG_WARNING, "Config error, 'read_all_devices' is no longer supported, please using 'read_pentair_pump'\n");
|
||||
if (text2bool(value))
|
||||
_aqconfig_.read_RS485_devmask |= READ_RS485_PEN_PUMP;
|
||||
else
|
||||
_aqconfig_.read_RS485_devmask &= ~READ_RS485_PEN_PUMP;
|
||||
rtn=true;
|
||||
*/
|
||||
} else if (strncasecmp (param, CFG_N_read_RS485_swg, CFG_C_read_RS485_swg) == 0) {
|
||||
if (text2bool(value))
|
||||
_aqconfig_.read_RS485_devmask |= READ_RS485_SWG;
|
||||
else
|
||||
_aqconfig_.read_RS485_devmask &= ~READ_RS485_SWG;
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_read_RS485_ePump, CFG_C_read_RS485_ePump) == 0) {
|
||||
if (text2bool(value))
|
||||
_aqconfig_.read_RS485_devmask |= READ_RS485_JAN_PUMP;
|
||||
else
|
||||
_aqconfig_.read_RS485_devmask &= ~READ_RS485_JAN_PUMP;
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_read_RS485_vsfPump, CFG_C_read_RS485_vsfPump) == 0) {
|
||||
if (text2bool(value))
|
||||
_aqconfig_.read_RS485_devmask |= READ_RS485_PEN_PUMP;
|
||||
else
|
||||
_aqconfig_.read_RS485_devmask &= ~READ_RS485_PEN_PUMP;
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_read_RS485_JXi, CFG_C_read_RS485_JXi) == 0) {
|
||||
if (text2bool(value))
|
||||
_aqconfig_.read_RS485_devmask |= READ_RS485_JAN_JXI;
|
||||
else
|
||||
_aqconfig_.read_RS485_devmask &= ~READ_RS485_JAN_JXI;
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_read_RS485_LX, CFG_C_read_RS485_LX) == 0) {
|
||||
if (text2bool(value))
|
||||
_aqconfig_.read_RS485_devmask |= READ_RS485_JAN_LX;
|
||||
else
|
||||
_aqconfig_.read_RS485_devmask &= ~READ_RS485_JAN_LX;
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_read_RS485_Chem, CFG_C_read_RS485_Chem) == 0) {
|
||||
if (text2bool(value))
|
||||
_aqconfig_.read_RS485_devmask |= READ_RS485_JAN_CHEM;
|
||||
else
|
||||
_aqconfig_.read_RS485_devmask &= ~READ_RS485_JAN_CHEM;
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_read_RS485_iAqualink, CFG_C_read_RS485_iAqualink) == 0) {
|
||||
/* This should not be used with enable_iaqualink */
|
||||
if (text2bool(value)) {
|
||||
if (_aqconfig_.enable_iaqualink)
|
||||
LOG(AQUA_LOG,LOG_WARNING, "Config error, 'read_RS485_iAqualink' is not valid when 'enable_iaqualink=yes', ignoring read_RS485_iAqualink!\n");
|
||||
else
|
||||
_aqconfig_.read_RS485_devmask |= READ_RS485_IAQUALNK;
|
||||
} else {
|
||||
_aqconfig_.read_RS485_devmask &= ~READ_RS485_IAQUALNK;
|
||||
}
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_use_panel_aux_labels, CFG_C_use_panel_aux_labels) == 0) {
|
||||
_aqconfig_.use_panel_aux_labels = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_force_swg, CFG_C_force_swg) == 0) {
|
||||
_aqconfig_.force_swg = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_force_ps_setpoints, CFG_C_force_ps_setpoints) == 0) {
|
||||
_aqconfig_.force_ps_setpoints = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_force_frzprotect_setpoints, CFG_C_force_frzprotect_setpoints) == 0) {
|
||||
_aqconfig_.force_frzprotect_setpoints = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_force_chem_feeder, CFG_C_force_chem_feeder) == 0) {
|
||||
_aqconfig_.force_chem_feeder = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, "debug_RSProtocol_bytes", 22) == 0) {
|
||||
_aqconfig_.log_raw_bytes = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, "debug_RSProtocol_packets", 24) == 0) {
|
||||
_aqconfig_.log_protocol_packets = text2bool(value);
|
||||
rtn=true;
|
||||
/*
|
||||
} else if (strncasecmp (param, "swg_zero_ignore_count", 21) == 0) {
|
||||
_aqconfig_.swg_zero_ignore = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
*/
|
||||
} else if (strncasecmp (param, "display_warnings_in_web", 23) == 0) {
|
||||
_aqconfig_.display_warnings_web = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_mqtt_timed_update, CFG_C_mqtt_timed_update) == 0) {
|
||||
_aqconfig_.mqtt_timed_update = text2bool(value);
|
||||
rtn=true;
|
||||
} else if ((strncasecmp (param, CFG_N_sync_panel_time, CFG_C_sync_panel_time) == 0) ||
|
||||
(strncasecmp (param, "keep_paneltime_synced", 21)) == 0) {
|
||||
_aqconfig_.sync_panel_time = text2bool(value);
|
||||
rtn=true;
|
||||
#ifdef AQ_NO_THREAD_NETSERVICE
|
||||
} else if (strncasecmp (param, "network_poll_speed", 18) == 0) {
|
||||
LOG(AQUA_LOG,LOG_WARNING, "Config error, 'network_poll_speed' is no longer supported, using value for 'rs_poll_speed'\n");
|
||||
_aqconfig_.rs_poll_speed = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, "rs_poll_speed", 13) == 0) {
|
||||
_aqconfig_.rs_poll_speed = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, "thread_netservices", 18) == 0) {
|
||||
_aqconfig_.thread_netservices = text2bool(value);
|
||||
rtn=true;
|
||||
#endif
|
||||
} else if (strncasecmp (param, CFG_N_enable_scheduler, CFG_C_enable_scheduler) == 0) {
|
||||
_aqconfig_.enable_scheduler = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_scheduler_check_poweron, CFG_C_scheduler_check_poweron) == 0) {
|
||||
if (text2bool(value)) {
|
||||
_aqconfig_.schedule_event_mask |= AQS_POWER_ON;
|
||||
}
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_scheduler_check_freezeprotectoff, CFG_C_scheduler_check_freezeprotectoff) == 0) {
|
||||
if (text2bool(value)) {
|
||||
_aqconfig_.schedule_event_mask |= AQS_FRZ_PROTECT_OFF;
|
||||
}
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_scheduler_check_boostoff, CFG_C_scheduler_check_boostoff) == 0) {
|
||||
if (text2bool(value)) {
|
||||
_aqconfig_.schedule_event_mask |= AQS_BOOST_OFF;
|
||||
}
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_scheduler_check_pumpon_hour, CFG_C_scheduler_check_pumpon_hour) == 0) {
|
||||
_aqconfig_.sched_chk_pumpon_hour = strtoul(value, NULL, 10);
|
||||
_aqconfig_.schedule_event_mask |= AQS_DONT_USE_CRON_PUMP_TIME;
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_scheduler_check_pumpoff_hour, CFG_C_scheduler_check_pumpoff_hour) == 0) {
|
||||
_aqconfig_.sched_chk_pumpoff_hour = strtoul(value, NULL, 10);
|
||||
_aqconfig_.schedule_event_mask |= AQS_DONT_USE_CRON_PUMP_TIME;
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_ftdi_low_latency, CFG_C_ftdi_low_latency) == 0) {
|
||||
_aqconfig_.ftdi_low_latency = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, CFG_N_rs485_frame_delay, CFG_C_rs485_frame_delay) == 0) {
|
||||
_aqconfig_.frame_delay = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, "device_pre_state", 16) == 0) {
|
||||
_aqconfig_.device_pre_state = text2bool(value);
|
||||
rtn=true;
|
||||
|
||||
#endif // CONFIG_DEV_TEST
|
||||
|
||||
|
||||
} else if (strncasecmp(param, "light_program_", 14) == 0) {
|
||||
int num = strtoul(param + 14, NULL, 10);
|
||||
if ( num >= LIGHT_COLOR_OPTIONS ) {
|
||||
|
@ -1464,12 +1188,17 @@ if (strlen(cleanwhitespace(value)) <= 0) {
|
|||
// LOG(AQUA_LOG,LOG_WARNING, "Config error, extended_device_id must on of the folowing (0x30,0x31,0x32,0x33), ignored setting : %s",param);
|
||||
} else if (strncasecmp(param + 17, "_label", 6) == 0) {
|
||||
char *label = cleanalloc(value);
|
||||
//aqkey *button = addVirtualButton(aqdata, label, num);
|
||||
aqkey *button = getVirtualButton(aqdata, num);
|
||||
if (button != NULL) {
|
||||
setVirtualButtonLabel(button, label);
|
||||
button->special_mask |= VIRTUAL_BUTTON;
|
||||
button->led->state = OFF;
|
||||
} else {
|
||||
LOG(AQUA_LOG,LOG_WARNING, "Error with '%s', total buttons=%d, config has %d already, ignoring!\n",param, TOTAL_BUTTONS, aqdata->total_buttons+1);
|
||||
}
|
||||
} else if (strncasecmp(param + 17, "_altlabel", 9) == 0) {
|
||||
char *label = cleanalloc(value);
|
||||
aqkey *button = getVirtualButton(aqdata, num);
|
||||
if (button != NULL) {
|
||||
setVirtualButtonAltLabel(button, label);
|
||||
} else {
|
||||
LOG(AQUA_LOG,LOG_WARNING, "Error with '%s', total buttons=%d, config has %d already, ignoring!\n",param, TOTAL_BUTTONS, aqdata->total_buttons+1);
|
||||
}
|
||||
|
@ -1782,7 +1511,7 @@ char *errorlevel2text(int level)
|
|||
return "";
|
||||
}
|
||||
|
||||
#ifdef CONFIG_EDITOR
|
||||
//#ifdef CONFIG_EDITOR
|
||||
|
||||
#define MAX_PRINTLEN 35
|
||||
void check_print_config (struct aqualinkdata *aqdata)
|
||||
|
@ -1817,6 +1546,29 @@ void check_print_config (struct aqualinkdata *aqdata)
|
|||
}
|
||||
}
|
||||
|
||||
// Check chiller
|
||||
if (ENABLE_CHILLER) {
|
||||
for (i = 0; i < aqdata->total_buttons; i++)
|
||||
{
|
||||
if (isVBUTTON_ALTLABEL(aqdata->aqbuttons[i].special_mask) && (rsm_strmatch(((vbutton_detail *)aqdata->aqbuttons[i].special_mask_ptr)->altlabel, "Chiller") == 0) ){
|
||||
aqdata->chiller_button = &aqdata->aqbuttons[i];
|
||||
} else if (isVBUTTON(aqdata->aqbuttons[i].special_mask) && rsm_strmatch(aqdata->aqbuttons[i].label, "Heat Pump") == 0 ) {
|
||||
LOG(AQUA_LOG,LOG_ERR, "Config error, `%s` is enabled, but Virtual Button Heat Pump does not have alt_name Chiller! Creating.",CFG_N_force_chiller);
|
||||
setVirtualButtonAltLabel(&aqdata->aqbuttons[i], "Chiller");
|
||||
aqdata->chiller_button = &aqdata->aqbuttons[i];
|
||||
aqdata->chiller_button->special_mask |= VIRTUAL_BUTTON_CHILLER;
|
||||
}
|
||||
}
|
||||
if (aqdata->chiller_button == NULL) {
|
||||
LOG(AQUA_LOG,LOG_ERR, "Config error, `%s` is enabled, but no Virtual Button set for Heat Pump / Chiller! Creating vbutton.",CFG_N_force_chiller);
|
||||
aqkey *button = getVirtualButton(aqdata, 0);
|
||||
setVirtualButtonLabel(button, "Heat Pump");
|
||||
setVirtualButtonAltLabel(button, "Chiller");
|
||||
aqdata->chiller_button = button;
|
||||
aqdata->chiller_button->special_mask |= VIRTUAL_BUTTON_CHILLER;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
_cfgParams[_numCfgParams].mask = READ_RS485_IAQUALNK;
|
||||
|
@ -1932,6 +1684,9 @@ void check_print_config (struct aqualinkdata *aqdata)
|
|||
sprintf(ext,"OneTouch %d |",aqdata->aqbuttons[i].rssd_code - 15);
|
||||
}
|
||||
}
|
||||
if (isVBUTTON_ALTLABEL(aqdata->aqbuttons[i].special_mask)) {
|
||||
sprintf(ext,"%-12s|", ((vbutton_detail *)aqdata->aqbuttons[i].special_mask_ptr)->altlabel);
|
||||
}
|
||||
if (aqdata->aqbuttons[i].dz_idx > 0) {
|
||||
sprintf(ext+strlen(ext), "dzidx %-3d",aqdata->aqbuttons[i].dz_idx);
|
||||
}
|
||||
|
@ -1945,6 +1700,7 @@ void check_print_config (struct aqualinkdata *aqdata)
|
|||
(_aqconfig_.extended_device_id < 0x30 || _aqconfig_.extended_device_id > 0x33 ) ){
|
||||
LOG(AQUA_LOG,LOG_WARNING, "Config error, extended_device_id must be on of the folowing (0x30,0x31,0x32,0x33) to use virtual button : '%s'",aqdata->aqbuttons[i].label);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (i = 0; i < aqdata->num_sensors; i++)
|
||||
|
@ -1952,8 +1708,12 @@ void check_print_config (struct aqualinkdata *aqdata)
|
|||
LOG(AQUA_LOG,LOG_NOTICE, "Config Sensor %02d = label %-15s | %s\n", i+1, aqdata->sensors[i].label,aqdata->sensors[i].path);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
bool remount_root_ro(bool readonly) {
|
||||
// NSF Check if config is RO_ROOT set
|
||||
|
@ -2109,8 +1869,8 @@ int save_config_js(const char* inBuf, int inSize, char* outBuf, int outSize, str
|
|||
return sprintf(outBuf, "{\"message\":\"Saved Config\"}");
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef CONFIG_EDITOR
|
||||
//#endif
|
||||
//#ifdef CONFIG_EDITOR
|
||||
|
||||
const char *pumpType2String(pump_type ptype) {
|
||||
switch (ptype) {
|
||||
|
@ -2247,7 +2007,6 @@ bool writeCfg (struct aqualinkdata *aqdata)
|
|||
|
||||
fprintf(fp,"\n%s_label=%s\n", prefix, aqdata->aqbuttons[i].label);
|
||||
|
||||
|
||||
if (isVS_PUMP(aqdata->aqbuttons[i].special_mask))
|
||||
{
|
||||
if (((pump_detail *)aqdata->aqbuttons[i].special_mask_ptr)->pumpIndex > 0) {
|
||||
|
@ -2272,9 +2031,11 @@ bool writeCfg (struct aqualinkdata *aqdata)
|
|||
} else if ( (isVBUTTON(aqdata->aqbuttons[i].special_mask) && aqdata->aqbuttons[i].rssd_code >= IAQ_ONETOUCH_1 && aqdata->aqbuttons[i].rssd_code <= IAQ_ONETOUCH_6 ) ) {
|
||||
fprintf(fp,"%s_onetouchID=%d\n", prefix, (aqdata->aqbuttons[i].rssd_code - 15));
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (isVBUTTON_ALTLABEL(aqdata->aqbuttons[i].special_mask)) {
|
||||
fprintf(fp,"%s_altlabel=%s\n", prefix, ((vbutton_detail *)aqdata->aqbuttons[i].special_mask_ptr)->altlabel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -2360,4 +2121,4 @@ bool writeCfg (struct aqualinkdata *aqdata)
|
|||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
#include "aq_serial.h"
|
||||
#include "aqualink.h"
|
||||
|
||||
#define CONFIG_DEV_TEST
|
||||
#define CONFIG_EDITOR
|
||||
|
||||
//#define DEFAULT_LOG_LEVEL 10
|
||||
#define DEFAULT_LOG_LEVEL LOG_NOTICE
|
||||
//#define DEFAULT_WEBPORT "6580"
|
||||
|
@ -174,12 +171,10 @@ char *ncleanalloc(char *str, int length);
|
|||
|
||||
const char *pumpType2String(pump_type ptype);
|
||||
|
||||
#ifdef CONFIG_EDITOR
|
||||
int save_config_js(const char* inBuf, int inSize, char* outBuf, int outSize, struct aqualinkdata *aqdata);
|
||||
void check_print_config (struct aqualinkdata *aqdata);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DEV_TEST) || defined(CONFIG_EDITOR)
|
||||
|
||||
typedef enum cfg_value_type{
|
||||
CFG_STRING,
|
||||
CFG_INT,
|
||||
|
@ -189,18 +184,25 @@ typedef enum cfg_value_type{
|
|||
CFG_BITMASK,
|
||||
CFG_SPECIAL
|
||||
} cfg_value_type;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEV_TEST
|
||||
|
||||
#define CFG_PERSISTANT (1 << 0) // Don't free memory, things referance the pointer
|
||||
#define CFG_NO_EDIT (1 << 1) // Don't allow editing
|
||||
#define CFG_GRP_ADVANCED (1 << 2) // Show in group advanced
|
||||
#define CFG_HIDE (1 << 3) // Like passwords.
|
||||
//#define CFG_ (1 << 3)
|
||||
|
||||
#define isMASKSET(mask, bit) ((mask & bit) == bit)
|
||||
|
||||
typedef struct cfgParam {
|
||||
void *value_ptr;
|
||||
void *default_value;
|
||||
//int max_value; // Max length of string (maybe mad int as well)
|
||||
cfg_value_type value_type;
|
||||
uint8_t config_mask;
|
||||
char *name;
|
||||
char *valid_values;
|
||||
uint8_t mask;
|
||||
bool advanced;
|
||||
//bool advanced;
|
||||
} cfgParam;
|
||||
|
||||
#ifndef CONFIG_C
|
||||
|
@ -210,7 +212,7 @@ extern int _numCfgParams;
|
|||
cfgParam _cfgParams[100];
|
||||
int _numCfgParams;
|
||||
#endif // CONFIG_C
|
||||
#endif // CONFIG_DEV_TEST
|
||||
|
||||
|
||||
// Below are missed
|
||||
//RSSD_LOG_filter
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
|
||||
static int _swg_noreply_cnt = 0;
|
||||
|
||||
void updateHeatPumpLed(aqledstate state, struct aqualinkdata *aqdata);
|
||||
|
||||
bool processJandyPacket(unsigned char *packet_buffer, int packet_length, struct aqualinkdata *aqdata)
|
||||
{
|
||||
static rsDeviceType interestedInNextAck = DRS_NONE;
|
||||
|
@ -969,14 +971,34 @@ bool processPacketToHeatPump(unsigned char *packet_buffer, int packet_length, st
|
|||
|
||||
beautifyPacket(msg, 1024, packet_buffer, packet_length, true);
|
||||
LOG(DJAN_LOG, LOG_INFO, "To HPump: %s\n", msg);
|
||||
|
||||
/* Byted 3 and 4
|
||||
0x0c|0x01 = Heat Pump Enabled
|
||||
0x0c|0x29 = Chiller on
|
||||
0x0c|0x00 = Off
|
||||
0x0c|0x09 = inknown at present
|
||||
0x0c|0x0a = unknown at present
|
||||
*/
|
||||
if (packet_buffer[3] == 0x0c ) {
|
||||
if (packet_buffer[4] == 0x00) {
|
||||
// Heat Pump is off
|
||||
LOG(DJAN_LOG, LOG_DEBUG, "Heat Pump 0x%02hhx is off\n",packet_buffer[2] );
|
||||
LOG(DJAN_LOG, LOG_DEBUG, "Heat Pump 0x%02hhx is Off - status 0x%02hhx\n",packet_buffer[2],packet_buffer[4] );
|
||||
updateHeatPumpLed(OFF, aqdata);
|
||||
} else if (packet_buffer[4] == 0x01) {
|
||||
LOG(DJAN_LOG, LOG_DEBUG, "Heat Pump 0x%02hhx is Enabled - status 0x%02hhx\n",packet_buffer[2],packet_buffer[4] );
|
||||
// Think this is Heat Pump Only, Not Chiller. Not sure.
|
||||
// Looks like heat pump name simply changes to chiller depending on in the water temp is above or below the chiller set point
|
||||
// So I think "Enabled" is the same for both.
|
||||
// So going to set it to enabled.
|
||||
updateHeatPumpLed(ENABLE, aqdata);
|
||||
} else if (packet_buffer[4] == 0x29) {
|
||||
// not sure if this is also Heat on.
|
||||
LOG(DJAN_LOG, LOG_DEBUG, "Heat Pump 0x%02hhx Chiller is On - status 0x%02hhx\n",packet_buffer[2],packet_buffer[4] );
|
||||
updateHeatPumpLed(ON, aqdata);
|
||||
} else {
|
||||
// Heat Pump is on or enabled
|
||||
LOG(DJAN_LOG, LOG_DEBUG, "Heat Pump 0x%02hhx is on or enabled\n",packet_buffer[2]);
|
||||
// Heat Pump is on or enabled (not sure what state), but set to something other than off
|
||||
LOG(DJAN_LOG, LOG_DEBUG, "Heat Pump 0x%02hhx is (unknown status) 0x%02hhx\n",packet_buffer[2], packet_buffer[4]);
|
||||
if (aqdata->chiller_button != NULL && aqdata->chiller_button->led->state == OFF)
|
||||
updateHeatPumpLed(ENABLE, aqdata); // Guess at enabled. ()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -986,12 +1008,56 @@ bool processPacketToHeatPump(unsigned char *packet_buffer, int packet_length, st
|
|||
bool processPacketFromHeatPump(unsigned char *packet_buffer, int packet_length, struct aqualinkdata *aqdata, const unsigned char previous_packet_to)
|
||||
{
|
||||
char msg[1024];
|
||||
/*
|
||||
HEX: 0x10|0x02|0x00|0x0d|0x40|0x00|0x00|0x5f|0x10|0x03|
|
||||
HEX: 0x10|0x02|0x00|0x0d|0x48|0x00|0x00|0x67|0x10|0x03|
|
||||
HEX: 0x10|0x02|0x00|0x0d|0x68|0x00|0x00|0x87|0x10|0x03|
|
||||
|
||||
// Reply is some status 0x40,0x48,0x68
|
||||
*/
|
||||
beautifyPacket(msg, 1024, packet_buffer, packet_length, true);
|
||||
LOG(DJAN_LOG, LOG_INFO, "From HPump: %s\n", msg);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void processHeatPumpDisplayMessage(char *msg, struct aqualinkdata *aqdata) {
|
||||
// Could get messages like below.
|
||||
// 'Heat Pump ENA'
|
||||
// ' Heat Pump ENA '
|
||||
// 'Heat Pump Enabled'
|
||||
// Or chiller.
|
||||
|
||||
// are we heat pump or chiller
|
||||
if (stristr(msg,"Chiller") != NULL) {
|
||||
// NSF Should check alt_mode is Chiller and not Heat Pump
|
||||
((vbutton_detail *)aqdata->chiller_button->special_mask_ptr)->in_alt_mode = true;
|
||||
}
|
||||
if (stristr(msg," ENA") != NULL) {
|
||||
updateHeatPumpLed(ENABLE, aqdata);
|
||||
} else if (stristr(msg," OFF") != NULL) {
|
||||
updateHeatPumpLed(OFF, aqdata);
|
||||
} else if (stristr(msg," ON") != NULL) {
|
||||
updateHeatPumpLed(ON, aqdata);
|
||||
}
|
||||
|
||||
LOG(AQUA_LOG,LOG_DEBUG, "Set %s to %s from message '%s'",
|
||||
((vbutton_detail *)aqdata->chiller_button->special_mask_ptr)->in_alt_mode?((vbutton_detail *)aqdata->chiller_button->special_mask_ptr)->altlabel:aqdata->chiller_button->label,
|
||||
aqdata->chiller_button->led->state==ENABLE?"Enabled":(aqdata->chiller_button->led->state==ON?"On":"Off"),
|
||||
msg);
|
||||
}
|
||||
|
||||
void updateHeatPumpLed(aqledstate state, struct aqualinkdata *aqdata) {
|
||||
|
||||
if (aqdata->chiller_button == NULL)
|
||||
return;
|
||||
|
||||
if (aqdata->chiller_button->led->state != state) {
|
||||
aqdata->chiller_button->led->state = ON;
|
||||
aqdata->updated = true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
// JXi Heater
|
||||
|
@ -1061,5 +1127,25 @@ LXi heater ping | HEX: 0x10|0x02|0x70|0x0c|0x29|0x00|0x00|0x00|0xb7|0x10|0x03|.
|
|||
LXi status | HEX: 0x10|0x02|0x00|0x0d|0x68|0x00|0x00|0x87|0x10|0x03| 0x68 probably is chiller ON
|
||||
|
||||
|
||||
0x0c|0x01 = Enabled
|
||||
0x0c|0x29 = Chiller on
|
||||
0x0c|0x00 = Off
|
||||
|
||||
Better Info
|
||||
Heat Pump Enabled
|
||||
JandyDvce: To HPump: Read Jandy packet To 0x70 of type LXi heater ping | HEX: 0x10|0x02|0x70|0x0c|0x01|0x00|0x00|0x00|0x8f|0x10|0x03|
|
||||
JandyDvce: From HPump: Read Jandy packet To 0x00 of type LXi status | HEX: 0x10|0x02|0x00|0x0d|0x40|0x00|0x00|0x5f|0x10|0x03|
|
||||
|
||||
Heat Pump (Chiller ON)
|
||||
JandyDvce: To HPump: Read Jandy packet To 0x70 of type LXi heater ping | HEX: 0x10|0x02|0x70|0x0c|0x29|0x00|0x00|0x00|0xb7|0x10|0x03|
|
||||
JandyDvce: From HPump: Read Jandy packet To 0x00 of type LXi status | HEX: 0x10|0x02|0x00|0x0d|0x68|0x00|0x00|0x87|0x10|0x03|
|
||||
|
||||
Heat Pump Enabled
|
||||
JandyDvce: To HPump: Read Jandy packet To 0x70 of type LXi heater ping | HEX: 0x10|0x02|0x70|0x0c|0x01|0x00|0x00|0x00|0x8f|0x10|0x03|
|
||||
JandyDvce: From HPump: Read Jandy packet To 0x00 of type LXi status | HEX: 0x10|0x02|0x00|0x0d|0x40|0x00|0x00|0x5f|0x10|0x03|
|
||||
|
||||
Heat Pump Off
|
||||
JandyDvce: To HPump: Read Jandy packet To 0x70 of type LXi heater ping | HEX: 0x10|0x02|0x70|0x0c|0x00|0x00|0x00|0x00|0x8e|0x10|0x03|
|
||||
JandyDvce: From HPump: Read Jandy packet To 0x00 of type LXi status | HEX: 0x10|0x02|0x00|0x0d|0x40|0x00|0x00|0x5f|0x10|0x03|
|
||||
|
||||
*/
|
|
@ -40,4 +40,6 @@ void getJandyHeaterErrorMQTT(struct aqualinkdata *aqdata, char *message);
|
|||
|
||||
int getPumpStatus(int pumpIndex, struct aqualinkdata *aqdata);
|
||||
|
||||
void processHeatPumpDisplayMessage(char *msg, struct aqualinkdata *aqdata);
|
||||
|
||||
#endif // AQUAPURE_H_
|
|
@ -510,7 +510,8 @@ void publish_mqtt_hassio_discover(struct aqualinkdata *aqdata, struct mg_connect
|
|||
send_mqtt(nc, topic, msg);
|
||||
}
|
||||
|
||||
if (ENABLE_CHILLER || (aqdata->chiller_set_point != TEMP_UNKNOWN && aqdata->chiller_state != LED_S_UNKNOWN) ) {
|
||||
//if (ENABLE_CHILLER || (aqdata->chiller_set_point != TEMP_UNKNOWN && aqdata->chiller_state != LED_S_UNKNOWN) ) {
|
||||
if ( (ENABLE_CHILLER || aqdata->chiller_set_point != TEMP_UNKNOWN ) && (aqdata->chiller_button != NULL) ) {
|
||||
// USe freeze protect for the moment.
|
||||
sprintf(msg, HASSIO_CHILLER_DISCOVER,
|
||||
connections,
|
||||
|
|
|
@ -289,6 +289,24 @@ void processTableMessage(unsigned char *message, int length)
|
|||
LOG(IAQT_LOG,LOG_ERR, "Run out of IAQT table buffer, need %d have %d\n",(int)message[5],IAQ_MSG_TABLE_LINES);
|
||||
}
|
||||
|
||||
int matchLabel2Button(const char* pageButtonName, aqkey *aqbutton, int ignorechars)
|
||||
{
|
||||
int rtn = rsm_strmatch_ignore(pageButtonName, aqbutton->label, ignorechars);
|
||||
|
||||
if (rtn == 0 && isVBUTTON_ALTLABEL(aqbutton->special_mask) ) {
|
||||
((vbutton_detail *)aqbutton->special_mask_ptr)->in_alt_mode = false;
|
||||
LOG(IAQT_LOG,LOG_DEBUG, "Virtual Button `%s` is NOT in alternate state of `%s`\n", aqbutton->label, ((vbutton_detail *)aqbutton->special_mask_ptr)->altlabel);
|
||||
} else if (rtn != 0 && isVBUTTON_ALTLABEL(aqbutton->special_mask) ) {
|
||||
rtn = rsm_strmatch_ignore(pageButtonName, ((vbutton_detail *)aqbutton->special_mask_ptr)->altlabel,ignorechars );
|
||||
if (rtn == 0 ) {
|
||||
((vbutton_detail *)aqbutton->special_mask_ptr)->in_alt_mode = true;
|
||||
LOG(IAQT_LOG,LOG_DEBUG, "Virtual Button `%s` is in alternate state of `%s`\n", aqbutton->label, ((vbutton_detail *)aqbutton->special_mask_ptr)->altlabel);
|
||||
}
|
||||
}
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
||||
// aqualinkd button found and updated, AQstart & AQend are index of aqualinkd button array
|
||||
void updateAQButtonFromPageButton(struct aqualinkdata *aq_data, struct iaqt_page_button *pageButton, int AQstartIndex, int AQendIndex)
|
||||
{
|
||||
|
@ -300,16 +318,27 @@ void updateAQButtonFromPageButton(struct aqualinkdata *aq_data, struct iaqt_page
|
|||
int rtn = -1;
|
||||
// If we are loading HOME page then simply button name is the label ie "Aux3"
|
||||
// If loading DEVICES? page then button name + status is "Aux3 OFF "
|
||||
if (_currentPageLoading == IAQ_PAGE_HOME)
|
||||
/*
|
||||
if (_currentPageLoading == IAQ_PAGE_HOME) {
|
||||
rtn = rsm_strmatch((const char *)pageButton->name, aq_data->aqbuttons[i].label);
|
||||
else
|
||||
if (rtn != 0 && isVBUTTON_ALTLABEL(aq_data->aqbuttons) ) {
|
||||
rtn = rsm_strmatch((const char *)pageButton->name, ((vbutton_detail *)aq_data->aqbuttons[i].special_mask_ptr)->altlabel );
|
||||
if (rtn = 0 ) {
|
||||
((vbutton_detail *)aq_data->aqbuttons[i].special_mask_ptr)->in_alt_mode = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rtn = rsm_strmatch_ignore((const char *)pageButton->name, aq_data->aqbuttons[i].label, 5); // 5 = 3 chars and 2 spaces ' OFF '
|
||||
}*/
|
||||
if (_currentPageLoading == IAQ_PAGE_HOME) {
|
||||
rtn = matchLabel2Button((const char *)pageButton->name, &aq_data->aqbuttons[i], 0);
|
||||
} else {
|
||||
rtn = matchLabel2Button((const char *)pageButton->name, &aq_data->aqbuttons[i], 5); // 5 = 3 chars and 2 spaces ' OFF '
|
||||
}
|
||||
|
||||
if (rtn == 0)
|
||||
{
|
||||
if (rtn == 0)
|
||||
{
|
||||
LOG(IAQT_LOG,LOG_DEBUG, "*** Found Status for %s state 0x%02hhx\n", aq_data->aqbuttons[i].label, pageButton->state);
|
||||
LOG(IAQT_LOG,LOG_DEBUG, "Found Status for %s state 0x%02hhx\n", aq_data->aqbuttons[i].label, pageButton->state);
|
||||
switch(pageButton->state) {
|
||||
case 0x00:
|
||||
if (aq_data->aqbuttons[i].led->state != OFF) {
|
||||
|
@ -345,7 +374,7 @@ void updateAQButtonFromPageButton(struct aqualinkdata *aq_data, struct iaqt_page
|
|||
//LOG(IAQT_LOG,LOG_NOTICE, "Unknown state 0x%02hhx for button %s\n",pageButton->state,pageButton->name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -354,12 +383,14 @@ void updateAQButtonFromPageButton(struct aqualinkdata *aq_data, struct iaqt_page
|
|||
// if we see chiller then it is enabled.
|
||||
// Not sure why button name changes from "Heat Pump" to "Chiller", need to figure this out. (might be pump)
|
||||
// THIS NEEDS TO BE DELETED AND MAKE A HEAT_PUMP / CHILLER BUTTON
|
||||
/*
|
||||
int ignore = 5;
|
||||
if (_currentPageLoading == IAQ_PAGE_HOME)
|
||||
ignore = 0;
|
||||
|
||||
if ( rsm_strmatch_ignore((const char *)pageButton->name, "Heat Pump", ignore) == 0 ) {
|
||||
aq_data->chiller_state = OFF;
|
||||
aq_data->chiller_mode = MD_HEATPUMP;
|
||||
aq_data->updated = true;
|
||||
//printf("********* Disable Chiller \n");
|
||||
} else if (rsm_strmatch_ignore((const char *)pageButton->name, "Chiller", ignore) == 0) {
|
||||
|
@ -377,9 +408,10 @@ void updateAQButtonFromPageButton(struct aqualinkdata *aq_data, struct iaqt_page
|
|||
aq_data->chiller_state = ENABLE;
|
||||
break;
|
||||
}
|
||||
aq_data->chiller_mode = MD_CHILLER;
|
||||
aq_data->updated = true;
|
||||
LOG(IAQT_LOG,LOG_DEBUG, "*** Found Status for %s state 0x%02hhx\n", "Chiller", pageButton->state);
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -756,12 +788,11 @@ void passDeviceStatusPage(struct aqualinkdata *aq_data)
|
|||
LOG(IAQT_LOG,LOG_INFO, "Set Cemlink ORP = %d PH = %f from message '%s'\n",orp,ph,_deviceStatus[i]);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (rsm_strcmp(_deviceStatus[i],"Chiller") == 0) {
|
||||
iaqt_device_update(aq_data, DEVICE_CHILLER);
|
||||
aq_data->chiller_state = ON;
|
||||
}
|
||||
*/
|
||||
|
||||
if (ENABLE_CHILLER && (rsm_strcmp(_deviceStatus[i],"Chiller") == 0 || rsm_strcmp(_deviceStatus[i],"Heat Pump") == 0 )) {
|
||||
processHeatPumpDisplayMessage(_deviceStatus[i], aq_data);
|
||||
}
|
||||
|
||||
//#ifdef READ_SWG_FROM_EXTENDED_ID
|
||||
else if (isPDA_PANEL) {
|
||||
if (rsm_strcmp(_deviceStatus[i],"AQUAPURE") == 0) {
|
||||
|
|
|
@ -518,12 +518,20 @@ void *set_aqualink_iaqtouch_device_on_off( void *ptr )
|
|||
// See if it's on the current page
|
||||
button = iaqtFindButtonByLabel(aq_data->aqbuttons[device].label);
|
||||
|
||||
if (button == NULL && isVBUTTON_ALTLABEL(aq_data->aqbuttons[device].special_mask) ) { // Try alt button name
|
||||
button = iaqtFindButtonByLabel(((vbutton_detail *)aq_data->aqbuttons[device].special_mask_ptr)->altlabel);
|
||||
}
|
||||
|
||||
if (button == NULL) {
|
||||
// No luck, go to the device page
|
||||
if ( goto_iaqt_page(IAQ_PAGE_DEVICES, aq_data) == false )
|
||||
goto f_end;
|
||||
|
||||
button = iaqtFindButtonByLabel(aq_data->aqbuttons[device].label);
|
||||
|
||||
if (button == NULL && isVBUTTON_ALTLABEL(aq_data->aqbuttons[device].special_mask) ) { // Try alt button name
|
||||
button = iaqtFindButtonByLabel(((vbutton_detail *)aq_data->aqbuttons[device].special_mask_ptr)->altlabel);
|
||||
}
|
||||
|
||||
// If not found see if page has next
|
||||
if (button == NULL && iaqtFindButtonByIndex(16)->type == 0x03 ) {
|
||||
|
|
|
@ -248,7 +248,8 @@ char *get_aux_information(aqkey *button, struct aqualinkdata *aqdata, char *buff
|
|||
int length = 0;
|
||||
buffer[0] = '\0';
|
||||
|
||||
if ((button->special_mask & VS_PUMP) == VS_PUMP)
|
||||
//if ((button->special_mask & VS_PUMP) == VS_PUMP)
|
||||
if (isVS_PUMP(button->special_mask))
|
||||
{
|
||||
//printf("Button %s is VSP\n", button->name);
|
||||
for (i=0; i < aqdata->num_pumps; i++) {
|
||||
|
@ -265,7 +266,8 @@ char *get_aux_information(aqkey *button, struct aqualinkdata *aqdata, char *buff
|
|||
}
|
||||
}
|
||||
}
|
||||
else if ((button->special_mask & PROGRAM_LIGHT) == PROGRAM_LIGHT)
|
||||
//else if ((button->special_mask & PROGRAM_LIGHT) == PROGRAM_LIGHT)
|
||||
else if (isPLIGHT(button->special_mask))
|
||||
{
|
||||
//printf("Button %s is ProgramableLight\n", button->name);
|
||||
for (i=0; i < aqdata->num_lights; i++) {
|
||||
|
@ -286,9 +288,14 @@ char *get_aux_information(aqkey *button, struct aqualinkdata *aqdata, char *buff
|
|||
}
|
||||
}
|
||||
}
|
||||
if (isVBUTTON_ALTLABEL(button->special_mask))
|
||||
{
|
||||
length += sprintf(buffer, ",\"alt_label\":\"%s\", \"in_alt_mode\": \"%s\" ",((vbutton_detail *)button->special_mask_ptr)->altlabel, ((vbutton_detail *)button->special_mask_ptr)->in_alt_mode?JSON_ON:JSON_OFF );
|
||||
//return buffer;
|
||||
}
|
||||
|
||||
//printf("Button %s is Switch\n", button->name);
|
||||
length += sprintf(buffer, ",\"type_ext\": \"switch_timer\", \"timer_active\":\"%s\"", (((button->special_mask & TIMER_ACTIVE) == TIMER_ACTIVE)?JSON_ON:JSON_OFF) );
|
||||
length += sprintf(buffer+length, ",\"type_ext\": \"switch_timer\", \"timer_active\":\"%s\"", (((button->special_mask & TIMER_ACTIVE) == TIMER_ACTIVE)?JSON_ON:JSON_OFF) );
|
||||
if ((button->special_mask & TIMER_ACTIVE) == TIMER_ACTIVE) {
|
||||
length += sprintf(buffer+length,",\"timer_duration\":\"%d\"", get_timer_left(button));
|
||||
}
|
||||
|
@ -392,9 +399,7 @@ int build_device_JSON(struct aqualinkdata *aqdata, char* buffer, int size, bool
|
|||
length += sprintf(buffer+length, "{\"type\": \"setpoint_freeze\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"status\": \"%s\", \"spvalue\": \"%.*f\", \"value\": \"%.*f\", \"int_status\": \"%d\" },",
|
||||
FREEZE_PROTECT,
|
||||
"Freeze Protection",
|
||||
//JSON_OFF,
|
||||
aqdata->frz_protect_state==ON?JSON_ON:JSON_OFF,
|
||||
//JSON_ENABLED,
|
||||
aqdata->frz_protect_state==ON?LED2text(ON):LED2text(ENABLE),
|
||||
((homekit)?2:0),
|
||||
((homekit_f)?degFtoC(aqdata->frz_protect_set_point):aqdata->frz_protect_set_point),
|
||||
|
@ -403,19 +408,19 @@ int build_device_JSON(struct aqualinkdata *aqdata, char* buffer, int size, bool
|
|||
aqdata->frz_protect_state==ON?1:0);
|
||||
}
|
||||
|
||||
if ( ENABLE_CHILLER || (aqdata->chiller_set_point != TEMP_UNKNOWN && getWaterTemp(aqdata) != TEMP_UNKNOWN) ) {
|
||||
if ( (ENABLE_CHILLER || (aqdata->chiller_set_point != TEMP_UNKNOWN && getWaterTemp(aqdata) != TEMP_UNKNOWN)) && (aqdata->chiller_button != NULL) ) {
|
||||
length += sprintf(buffer+length, "{\"type\": \"setpoint_chiller\", \"id\": \"%s\", \"name\": \"%s\", \"state\": \"%s\", \"status\": \"%s\", \"spvalue\": \"%.*f\", \"value\": \"%.*f\", \"int_status\": \"%d\" },",
|
||||
CHILLER,
|
||||
"Chiller",
|
||||
//JSON_OFF,
|
||||
aqdata->chiller_state==ON?JSON_ON:JSON_OFF,
|
||||
//JSON_ENABLED,
|
||||
aqdata->chiller_state==ON?LED2text(ON):LED2text(ENABLE),
|
||||
//aqdata->chiller_state==ON?JSON_ON:JSON_OFF,
|
||||
((vbutton_detail *)aqdata->chiller_button->special_mask_ptr)->in_alt_mode?JSON_ON:JSON_OFF,
|
||||
//aqdata->chiller_state==ON?LED2text(ON):LED2text(ENABLE),
|
||||
((vbutton_detail *)aqdata->chiller_button->special_mask_ptr)->in_alt_mode?(aqdata->chiller_button->led->state==ON?LED2text(ON):LED2text(ENABLE)):JSON_OFF,
|
||||
((homekit)?2:0),
|
||||
((homekit_f)?degFtoC(aqdata->chiller_set_point):aqdata->chiller_set_point),
|
||||
((homekit)?2:0),
|
||||
((homekit_f)?degFtoC(getWaterTemp(aqdata)):getWaterTemp(aqdata)),
|
||||
aqdata->chiller_state==ON?1:0);
|
||||
aqdata->chiller_button->led->state==ON?1:0);
|
||||
}
|
||||
|
||||
if (aqdata->swg_led_state != LED_S_UNKNOWN) {
|
||||
|
@ -555,11 +560,8 @@ int build_aqualink_aqmanager_JSON(struct aqualinkdata *aqdata, char* buffer, int
|
|||
|
||||
length += sprintf(buffer+length, "{\"type\": \"aqmanager\"");
|
||||
length += sprintf(buffer+length, ",\"deamonized\": \"%s\"", (_aqconfig_.deamonize?JSON_ON:JSON_OFF) );
|
||||
#ifdef CONFIG_EDITOR
|
||||
length += sprintf(buffer+length, ",\"config_editor\": \"yes\"");
|
||||
#else
|
||||
length += sprintf(buffer+length, ",\"config_editor\": \"no\"");
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
length += sprintf(buffer+length, ",\"panel_type\":\"%s\"",getPanelString());
|
||||
|
@ -1106,9 +1108,9 @@ int json_cfg_element_OLD(char* buffer, int size, const char *name, const void *v
|
|||
}
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_EDITOR
|
||||
//#ifdef CONFIG_EDITOR
|
||||
|
||||
int json_cfg_element(char* buffer, int size, const char *name, const void *value, cfg_value_type type, uint8_t mask, char *valid_val, bool advanced) {
|
||||
int json_cfg_element(char* buffer, int size, const char *name, const void *value, cfg_value_type type, uint8_t mask, char *valid_val, uint8_t config_mask) {
|
||||
int result = 0;
|
||||
|
||||
char valid_values[256];
|
||||
|
@ -1118,7 +1120,7 @@ int json_cfg_element(char* buffer, int size, const char *name, const void *value
|
|||
sprintf(valid_values,",\"valid values\":%s",valid_val);
|
||||
}
|
||||
|
||||
sprintf(adv,",\"advanced\": \"%s\"", advanced?"yes":"no");
|
||||
sprintf(adv,",\"advanced\": \"%s\"", isMASKSET(config_mask, CFG_GRP_ADVANCED)?"yes":"no");
|
||||
|
||||
|
||||
switch(type){
|
||||
|
@ -1227,7 +1229,7 @@ int build_aqualink_config_JSON(char* buffer, int size, struct aqualinkdata *aq_d
|
|||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_DEV_TEST
|
||||
//#ifdef CONFIG_DEV_TEST
|
||||
for (int i=0; i <= _numCfgParams; i++) {
|
||||
// We can't change web_directory or port while running, so don;t even chow those options.
|
||||
// mongoose holds a pointer to the string web_directoy, so can;t change that easily while running
|
||||
|
@ -1236,7 +1238,7 @@ int build_aqualink_config_JSON(char* buffer, int size, struct aqualinkdata *aq_d
|
|||
strncasecmp(_cfgParams[i].name, CFG_N_web_directory, strlen(CFG_N_web_directory)) == 0 ) {
|
||||
continue;
|
||||
}
|
||||
if ((result = json_cfg_element(buffer+length, size-length, _cfgParams[i].name, _cfgParams[i].value_ptr, _cfgParams[i].value_type, _cfgParams[i].mask, _cfgParams[i].valid_values, _cfgParams[i].advanced)) <= 0) {
|
||||
if ((result = json_cfg_element(buffer+length, size-length, _cfgParams[i].name, _cfgParams[i].value_ptr, _cfgParams[i].value_type, _cfgParams[i].mask, _cfgParams[i].valid_values, _cfgParams[i].config_mask)) <= 0) {
|
||||
LOG(NET_LOG,LOG_ERR, "Config json buffer full in, result truncated! size=%d curently used=%d\n",size,length);
|
||||
return length;
|
||||
} else {
|
||||
|
@ -1244,10 +1246,6 @@ int build_aqualink_config_JSON(char* buffer, int size, struct aqualinkdata *aq_d
|
|||
}
|
||||
}
|
||||
|
||||
// TODO add custom light modes/colors
|
||||
// TODO add RSSD LOG FILTERS
|
||||
// Add custom censors
|
||||
|
||||
for (i = 1; i <= aq_data->num_sensors; i++)
|
||||
{
|
||||
length += sprintf(buffer+length, ",\"sensor_%.2d\":{ \"advanced\":\"yes\",",i );
|
||||
|
@ -1258,19 +1256,19 @@ int build_aqualink_config_JSON(char* buffer, int size, struct aqualinkdata *aq_d
|
|||
//fprintf(fp,"sensor_%.2d_label=%s\n",i+1,aqdata->sensors->label);
|
||||
//fprintf(fp,"sensor_%.2d_factor=%f\n",i+1,aqdata->sensors->factor);
|
||||
sprintf(buf,"sensor_%.2d_path", i);
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &aq_data->sensors[i-1].path, CFG_STRING, 0, NULL, true)) <= 0)
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &aq_data->sensors[i-1].path, CFG_STRING, 0, NULL, CFG_GRP_ADVANCED)) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
||||
sprintf(buf,"sensor_%.2d_label", i);
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &aq_data->sensors[i-1].label, CFG_STRING, 0, NULL, true)) <= 0)
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &aq_data->sensors[i-1].label, CFG_STRING, 0, NULL, CFG_GRP_ADVANCED)) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
||||
sprintf(buf,"sensor_%.2d_factor", i);
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &aq_data->sensors[i-1].factor, CFG_FLOAT, 0, NULL, true)) <= 0)
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &aq_data->sensors[i-1].factor, CFG_FLOAT, 0, NULL, CFG_GRP_ADVANCED)) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
@ -1292,7 +1290,7 @@ int build_aqualink_config_JSON(char* buffer, int size, struct aqualinkdata *aq_d
|
|||
sprintf(buf,"light_program_%.2d", i);
|
||||
sprintf(buf1,"%s%s",lname,isShow?" - show":"");
|
||||
//printf("%s %s\n",buf,buf1);
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &bufptr, CFG_STRING, 0, NULL, true)) <= 0)
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &bufptr, CFG_STRING, 0, NULL, CFG_GRP_ADVANCED)) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
@ -1302,109 +1300,8 @@ int build_aqualink_config_JSON(char* buffer, int size, struct aqualinkdata *aq_d
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
if ((result = json_cfg_element(buffer+length, size-length, "config_file", _aqconfig_.config_file, CFG_STRING, NULL)) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
*/
|
||||
/*
|
||||
stringptr = getPanelString();
|
||||
if ((result = json_cfg_element(buffer+length, size-length, CFG_N_panel_type, &stringptr, CFG_STRING, 0, NULL)) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
||||
if ((result = json_cfg_element(buffer+length, size-length, CFG_N_device_id, &_aqconfig_.device_id, CFG_HEX, 0, "[\"0x0a\", \"0x0b\", \"0x09\", \"0x08\", \"0x60\", \"0xFF\"]")) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
||||
if ((result = json_cfg_element(buffer+length, size-length, CFG_N_rssa_device_id, &_aqconfig_.rssa_device_id, CFG_HEX, 0, "[\"0x00\", \"0x48\", \"0xFF\"]")) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
||||
#if defined AQ_ONETOUCH || defined AQ_IAQTOUCH
|
||||
if ((result = json_cfg_element(buffer+length, size-length, CFG_N_extended_device_id, &_aqconfig_.extended_device_id, CFG_HEX, 0, "[\"0x00\", \"0x30\", \"0x31\", \"0x32\", \"0x33\", \"0x40\", \"0x41\", \"0x42\", \"0x43\", \"0xFF\"]")) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
||||
if ((result = json_cfg_element(buffer+length, size-length, CFG_N_extended_device_id, &_aqconfig_.extended_device_id_programming, CFG_BOOL, 0, "[\"YES\", \"NO\"]")) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
||||
if ((result = json_cfg_element(buffer+length, size-length, CFG_N_enable_iaqualink, &_aqconfig_.enable_iaqualink, CFG_BOOL, 0, "[\"YES\", \"NO\"]")) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
#endif
|
||||
|
||||
if ((result = json_cfg_element(buffer+length, size-length, CFG_N_serial_port, &_aqconfig_.serial_port, CFG_STRING, 0, NULL)) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
||||
if ((result = json_cfg_element(buffer+length, size-length, CFG_N_socket_port, &_aqconfig_.socket_port, CFG_STRING, 0, NULL )) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
||||
stringptr = loglevel2cgn_name(_aqconfig_.log_level);
|
||||
if ((result = json_cfg_element(buffer+length, size-length, CFG_N_log_level, &stringptr, CFG_STRING, 0, "[\"DEBUG\", \"INFO\", \"NOTICE\", \"WARNING\", \"ERROR\"]")) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
||||
if ((result = json_cfg_element(buffer+length, size-length, CFG_N_web_directory, &_aqconfig_.web_directory, CFG_STRING, 0, NULL)) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ((result = json_cfg_element(buffer+length, size-length, "sched_chk_pumpon_hour", &_aqconfig_.sched_chk_pumpon_hour, CFG_INT, 0, NULL )) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
||||
|
||||
// OTHERS
|
||||
|
||||
|
||||
|
||||
// OTHERS
|
||||
|
||||
if ((result = json_cfg_element(buffer+length, size-length, "force_swg", &_aqconfig_.force_swg, CFG_BOOL, 0, "[\"YES\", \"NO\"]")) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
||||
if ((result = json_cfg_element(buffer+length, size-length, "use_panel_aux_labels", &_aqconfig_.use_panel_aux_labels, CFG_BOOL, 0, NULL)) <= 0)
|
||||
return length;
|
||||
else
|
||||
length += result;
|
||||
|
||||
*/
|
||||
#endif // CONGIG_DEV_TEST
|
||||
// All buttons
|
||||
|
||||
|
||||
for (i = 0; i < aq_data->total_buttons; i++)
|
||||
{
|
||||
char prefix[30];
|
||||
|
@ -1420,7 +1317,7 @@ int build_aqualink_config_JSON(char* buffer, int size, struct aqualinkdata *aq_d
|
|||
delectCharAt = length;
|
||||
|
||||
sprintf(buf,"%s_label", prefix);
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &aq_data->aqbuttons[i].label, CFG_STRING, 0, NULL, false)) <= 0) {
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &aq_data->aqbuttons[i].label, CFG_STRING, 0, NULL, 0)) <= 0) {
|
||||
LOG(NET_LOG,LOG_ERR, "Config json buffer full in, result truncated! size=%d curently used=%d\n",size,length);
|
||||
return length;
|
||||
} else
|
||||
|
@ -1430,7 +1327,7 @@ int build_aqualink_config_JSON(char* buffer, int size, struct aqualinkdata *aq_d
|
|||
{
|
||||
if (((pump_detail *)aq_data->aqbuttons[i].special_mask_ptr)->pumpIndex > 0) {
|
||||
sprintf(buf,"%s_pumpIndex", prefix);
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &((pump_detail *)aq_data->aqbuttons[i].special_mask_ptr)->pumpIndex, CFG_INT, 0, NULL, false)) <= 0) {
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &((pump_detail *)aq_data->aqbuttons[i].special_mask_ptr)->pumpIndex, CFG_INT, 0, NULL, 0)) <= 0) {
|
||||
LOG(NET_LOG,LOG_ERR, "Config json buffer full in, result truncated! size=%d curently used=%d\n",size,length);
|
||||
return length;
|
||||
} else
|
||||
|
@ -1439,7 +1336,7 @@ int build_aqualink_config_JSON(char* buffer, int size, struct aqualinkdata *aq_d
|
|||
|
||||
if (((pump_detail *)aq_data->aqbuttons[i].special_mask_ptr)->pumpID != NUL) {
|
||||
sprintf(buf,"%s_pumpID", prefix);
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &((pump_detail *)aq_data->aqbuttons[i].special_mask_ptr)->pumpID, CFG_HEX, 0, NULL, false)) <= 0) {
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &((pump_detail *)aq_data->aqbuttons[i].special_mask_ptr)->pumpID, CFG_HEX, 0, NULL, 0)) <= 0) {
|
||||
LOG(NET_LOG,LOG_ERR, "Config json buffer full in, result truncated! size=%d curently used=%d\n",size,length);
|
||||
return length;
|
||||
} else
|
||||
|
@ -1449,7 +1346,7 @@ int build_aqualink_config_JSON(char* buffer, int size, struct aqualinkdata *aq_d
|
|||
if (((pump_detail *)aq_data->aqbuttons[i].special_mask_ptr)->pumpName[0] != '\0') {
|
||||
sprintf(buf,"%s_pumpName", prefix);
|
||||
stringptr = ((pump_detail *)aq_data->aqbuttons[i].special_mask_ptr)->pumpName;
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &stringptr, CFG_STRING, 0, NULL, false)) <= 0) {
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &stringptr, CFG_STRING, 0, NULL, 0)) <= 0) {
|
||||
LOG(NET_LOG,LOG_ERR, "Config json buffer full in, result truncated! size=%d curently used=%d\n",size,length);
|
||||
return length;
|
||||
} else
|
||||
|
@ -1459,7 +1356,7 @@ int build_aqualink_config_JSON(char* buffer, int size, struct aqualinkdata *aq_d
|
|||
if (((pump_detail *)aq_data->aqbuttons[i].special_mask_ptr)->pumpType != PT_UNKNOWN) {
|
||||
sprintf(buf,"%s_pumpType", prefix);
|
||||
stringptr = pumpType2String(((pump_detail *)aq_data->aqbuttons[i].special_mask_ptr)->pumpType);
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &stringptr, CFG_STRING, 0, "[\"JANDY ePUMP\",\"Pentair VS\",\"Pentair VF\"]", false) ) <= 0) {
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &stringptr, CFG_STRING, 0, "[\"JANDY ePUMP\",\"Pentair VS\",\"Pentair VF\"]", 0) ) <= 0) {
|
||||
LOG(NET_LOG,LOG_ERR, "Config json buffer full in, result truncated! size=%d curently used=%d\n",size,length);
|
||||
return length;
|
||||
} else
|
||||
|
@ -1468,7 +1365,7 @@ int build_aqualink_config_JSON(char* buffer, int size, struct aqualinkdata *aq_d
|
|||
} else if (isPLIGHT(aq_data->aqbuttons[i].special_mask)) {
|
||||
if (((clight_detail *)aq_data->aqbuttons[i].special_mask_ptr)->lightType > 0) {
|
||||
sprintf(buf,"%s_lightMode", prefix);
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &((clight_detail *)aq_data->aqbuttons[i].special_mask_ptr)->lightType, CFG_INT, 0, NULL, false)) <= 0) {
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &((clight_detail *)aq_data->aqbuttons[i].special_mask_ptr)->lightType, CFG_INT, 0, NULL, 0)) <= 0) {
|
||||
LOG(NET_LOG,LOG_ERR, "Config json buffer full in, result truncated! size=%d curently used=%d\n",size,length);
|
||||
return length;
|
||||
} else
|
||||
|
@ -1477,11 +1374,18 @@ int build_aqualink_config_JSON(char* buffer, int size, struct aqualinkdata *aq_d
|
|||
} else if ( (isVBUTTON(aq_data->aqbuttons[i].special_mask) && aq_data->aqbuttons[i].rssd_code >= IAQ_ONETOUCH_1 && aq_data->aqbuttons[i].rssd_code <= IAQ_ONETOUCH_6 ) ) {
|
||||
sprintf(buf,"%s_onetouchID", prefix);
|
||||
int oID = (aq_data->aqbuttons[i].rssd_code - 15);
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &oID, CFG_INT, 0, "[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]", false)) <= 0) {
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &oID, CFG_INT, 0, "[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]", 0)) <= 0) {
|
||||
LOG(NET_LOG,LOG_ERR, "Config json buffer full in, result truncated! size=%d curently used=%d\n",size,length);
|
||||
return length;
|
||||
} else
|
||||
length += result;
|
||||
} else if ( isVBUTTON_ALTLABEL(aq_data->aqbuttons[i].special_mask)) {
|
||||
sprintf(buf,"%s_altlabel", prefix);
|
||||
if ((result = json_cfg_element(buffer+length, size-length, buf, &((vbutton_detail *)aq_data->aqbuttons[i].special_mask_ptr)->altlabel, CFG_STRING, 0, NULL, 0)) <= 0) {
|
||||
LOG(NET_LOG,LOG_ERR, "Config json buffer full in, result truncated! size=%d curently used=%d\n",size,length);
|
||||
return length;
|
||||
} else
|
||||
length += result;
|
||||
}
|
||||
|
||||
length += sprintf(buffer+length, "}" );
|
||||
|
@ -1512,4 +1416,4 @@ int build_aqualink_config_JSON(char* buffer, int size, struct aqualinkdata *aq_d
|
|||
}
|
||||
|
||||
|
||||
#endif
|
||||
//#endif
|
|
@ -71,6 +71,7 @@ static int _mqtt_exit_flag = false;
|
|||
#ifndef MG_DISABLE_MQTT
|
||||
void start_mqtt(struct mg_mgr *mgr);
|
||||
static struct aqualinkdata _last_mqtt_aqualinkdata;
|
||||
static aqled _last_mqtt_chiller_led;
|
||||
void mqtt_broadcast_aqualinkstate(struct mg_connection *nc);
|
||||
#endif
|
||||
|
||||
|
@ -787,15 +788,26 @@ void mqtt_broadcast_aqualinkstate(struct mg_connection *nc)
|
|||
//send_mqtt_string_msg(nc, FREEZE_PROTECT_ENABELED, MQTT_ON);
|
||||
}
|
||||
|
||||
if (_aqualink_data->chiller_set_point != TEMP_UNKNOWN && _aqualink_data->chiller_set_point != _last_mqtt_aqualinkdata.chiller_set_point) {
|
||||
_last_mqtt_aqualinkdata.chiller_set_point = _aqualink_data->chiller_set_point;
|
||||
send_mqtt_setpoint_msg(nc, CHILLER, _aqualink_data->chiller_set_point);
|
||||
//send_mqtt_string_msg(nc, CHILLER_ENABELED, MQTT_ON);
|
||||
}
|
||||
if (_aqualink_data->chiller_state != _last_mqtt_aqualinkdata.chiller_state) {
|
||||
_last_mqtt_aqualinkdata.chiller_state = _aqualink_data->chiller_state;
|
||||
//send_mqtt_string_msg(nc, CHILLER, _aqualink_data->chiller_state==ON?MQTT_ON:MQTT_OFF);
|
||||
send_mqtt_led_state_msg(nc, CHILLER, _aqualink_data->chiller_state, MQTT_COOL, MQTT_OFF);
|
||||
if (ENABLE_CHILLER) {
|
||||
if (_aqualink_data->chiller_set_point != TEMP_UNKNOWN && _aqualink_data->chiller_set_point != _last_mqtt_aqualinkdata.chiller_set_point) {
|
||||
_last_mqtt_aqualinkdata.chiller_set_point = _aqualink_data->chiller_set_point;
|
||||
send_mqtt_setpoint_msg(nc, CHILLER, _aqualink_data->chiller_set_point);
|
||||
}
|
||||
|
||||
// Chiller is only on when in_alt_mode = true and led != off
|
||||
if ( _aqualink_data->chiller_button != NULL && ((vbutton_detail *) _aqualink_data->chiller_button->special_mask_ptr)->in_alt_mode == false ) {
|
||||
// Chiller is off (in heat pump mode)
|
||||
if (OFF != _last_mqtt_chiller_led.state) {
|
||||
_last_mqtt_chiller_led.state = OFF;
|
||||
send_mqtt_led_state_msg(nc, CHILLER, OFF, MQTT_COOL, MQTT_OFF);
|
||||
}
|
||||
} else if (_aqualink_data->chiller_button != NULL && ((vbutton_detail *) _aqualink_data->chiller_button->special_mask_ptr)->in_alt_mode == true ) {
|
||||
// post actual LED state, in chiller mode
|
||||
if (_aqualink_data->chiller_button->led->state != _last_mqtt_chiller_led.state) {
|
||||
_last_mqtt_chiller_led.state = _aqualink_data->chiller_button->led->state;
|
||||
send_mqtt_led_state_msg(nc, CHILLER, _aqualink_data->chiller_button->led->state, MQTT_COOL, MQTT_OFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_aqualink_data->battery != _last_mqtt_aqualinkdata.battery) {
|
||||
|
@ -1375,7 +1387,8 @@ uriAtype action_URI(request_source from, const char *URI, int uri_length, float
|
|||
} else { // Pump by button name
|
||||
for (i=0; i < _aqualink_data->total_buttons ; i++) {
|
||||
//if (strncmp(ri1, _aqualink_data->aqbuttons[i].name, strlen(_aqualink_data->aqbuttons[i].name)) == 0 ){
|
||||
if ( uri_strcmp(ri1, _aqualink_data->aqbuttons[i].name)) {
|
||||
if ( uri_strcmp(ri1, _aqualink_data->aqbuttons[i].name) ||
|
||||
( isVBUTTON_ALTLABEL(_aqualink_data->aqbuttons[i].special_mask) && uri_strcmp(ri1, ((vbutton_detail *)_aqualink_data->aqbuttons[i].special_mask_ptr)->altlabel)) ) {
|
||||
int pi;
|
||||
for (pi=0; pi < _aqualink_data->num_pumps; pi++) {
|
||||
if (_aqualink_data->pumps[pi].button == &_aqualink_data->aqbuttons[i]) {
|
||||
|
@ -1722,7 +1735,6 @@ void action_web_request(struct mg_connection *nc, struct http_message *http_msg)
|
|||
mg_send(nc, message, size);
|
||||
}
|
||||
break;
|
||||
#ifdef CONFIG_EDITOR
|
||||
case uConfig:
|
||||
{
|
||||
char message[JSON_BUFFER_SIZE];
|
||||
|
@ -1733,7 +1745,6 @@ void action_web_request(struct mg_connection *nc, struct http_message *http_msg)
|
|||
mg_send(nc, message, size);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifndef AQ_MANAGER
|
||||
case uDebugStatus:
|
||||
{
|
||||
|
@ -1892,7 +1903,6 @@ void action_websocket_request(struct mg_connection *nc, struct websocket_message
|
|||
ws_send(nc, message);
|
||||
}
|
||||
break;
|
||||
#ifdef CONFIG_EDITOR
|
||||
case uConfig:
|
||||
{
|
||||
DEBUG_TIMER_START(&tid);
|
||||
|
@ -1911,7 +1921,6 @@ void action_websocket_request(struct mg_connection *nc, struct websocket_message
|
|||
ws_send(nc, message);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case uBad:
|
||||
default:
|
||||
if (msg == NULL)
|
||||
|
@ -2110,6 +2119,9 @@ void reset_last_mqtt_status()
|
|||
|
||||
for (i=0; i < _aqualink_data->total_buttons; i++) {
|
||||
_last_mqtt_aqualinkdata.aqualinkleds[i].state = LED_S_UNKNOWN;
|
||||
//if (isVBUTTON_CHILLER(_aqualink_data->aqbuttons[i].special_mask)){
|
||||
// _chiller_ledindex = i;
|
||||
//}
|
||||
}
|
||||
_last_mqtt_aqualinkdata.ar_swg_device_status = SWG_STATUS_UNKNOWN;
|
||||
_last_mqtt_aqualinkdata.swg_led_state = LED_S_UNKNOWN;
|
||||
|
@ -2123,7 +2135,7 @@ void reset_last_mqtt_status()
|
|||
_last_mqtt_aqualinkdata.pool_htr_set_point = TEMP_REFRESH;
|
||||
_last_mqtt_aqualinkdata.spa_htr_set_point = TEMP_REFRESH;
|
||||
_last_mqtt_aqualinkdata.chiller_set_point = TEMP_REFRESH;
|
||||
_last_mqtt_aqualinkdata.chiller_state = LED_S_UNKNOWN;
|
||||
//_last_mqtt_aqualinkdata.chiller_state = LED_S_UNKNOWN;
|
||||
_last_mqtt_aqualinkdata.ph = -1;
|
||||
_last_mqtt_aqualinkdata.orp = -1;
|
||||
_last_mqtt_aqualinkdata.boost = -1;
|
||||
|
@ -2149,6 +2161,8 @@ void reset_last_mqtt_status()
|
|||
_last_mqtt_aqualinkdata.sensors[i].value = TEMP_UNKNOWN;
|
||||
}
|
||||
|
||||
_last_mqtt_chiller_led.state = LED_S_UNKNOWN;
|
||||
|
||||
}
|
||||
|
||||
void start_mqtt(struct mg_mgr *mgr) {
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
#define AQUALINKD_SHORT_NAME "AqualinkD"
|
||||
|
||||
// Use Magor . Minor . Patch
|
||||
#define AQUALINKD_VERSION "2.6.0 (dev)"
|
||||
#define AQUALINKD_VERSION "2.6.0 (dev 0.2)"
|
||||
|
|
Loading…
Reference in New Issue