mirror of https://github.com/sfeakes/AqualinkD.git
3.5.1 Dev update
parent
0b1b7f055f
commit
3608f9f4ae
|
@ -128,6 +128,10 @@ NEED TO FIX FOR THIS RELEASE.
|
|||
* check rs serial adapter is active if light color mode 11 is used.
|
||||
-->
|
||||
|
||||
|
||||
# Updates in 2.5.1 (dev)
|
||||
* Added scheduling of pump after events (Power On, Freeze Protect, Boost)
|
||||
|
||||
# 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.
Binary file not shown.
|
@ -161,6 +161,15 @@ rs485_frame_delay = 0
|
|||
# If you used the install script and didn;t receive any cron warnings, you should be good to go.
|
||||
enable_scheduler = yes
|
||||
|
||||
# Check if button_01 (usually Pump) is scheduled to run after an event that may have turned it off, and set it to run.
|
||||
# Only for RS panels, Will not work for PDA panles.
|
||||
# Example below is if pump is off due to power reset, freezeprotect/swg boots turned off between 6am and 11pm turn the pump on.
|
||||
#scheduler_check_pumpon_hour = 6
|
||||
#scheduler_check_pumpoff_hour = 23
|
||||
#scheduler_check_poweron = yes
|
||||
#scheduler_check_freezeprotectoff = yes
|
||||
#scheduler_check_boostoff = yes
|
||||
|
||||
# Put AqualinkD to sleep when in PDA mode after inactivity.
|
||||
# Ignore if you are not using PDA mode.
|
||||
# If you have Jandy PDA then this MUST be set to yes as the controller can only support one PDA.
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -9,6 +9,7 @@
|
|||
#include "devices_jandy.h"
|
||||
#include "allbutton_aq_programmer.h"
|
||||
#include "color_lights.h"
|
||||
#include "aq_scheduler.h"
|
||||
|
||||
/* Below can also be called from serialadapter.c */
|
||||
void processLEDstate(struct aqualinkdata *aq_data, unsigned char *packet, logmask_t from)
|
||||
|
@ -223,8 +224,14 @@ void _processMessage(char *message, struct aqualinkdata *aq_data, bool reset)
|
|||
aq_data->last_display_message[1] = '\0';
|
||||
|
||||
// Anything that wasn't on during the last set of messages, turn off
|
||||
if ((msg_loop & MSG_FREEZE) != MSG_FREEZE)
|
||||
if ((msg_loop & MSG_FREEZE) != MSG_FREEZE) {
|
||||
if (aq_data->frz_protect_state != default_frz_protect_state) {
|
||||
LOG(ALLB_LOG,LOG_INFO, "Freeze protect turned off\n");
|
||||
event_happened_set_device_state(FREEZE_PROTECT_OFF, aq_data);
|
||||
// Add code to check Pump if to turn it on (was scheduled) ie time now is inbetween ON / OFF schedule
|
||||
}
|
||||
aq_data->frz_protect_state = default_frz_protect_state;
|
||||
}
|
||||
|
||||
if ((msg_loop & MSG_SERVICE) != MSG_SERVICE &&
|
||||
(msg_loop & MSG_TIMEOUT) != MSG_TIMEOUT ) {
|
||||
|
@ -277,6 +284,11 @@ void _processMessage(char *message, struct aqualinkdata *aq_data, bool reset)
|
|||
}
|
||||
*/
|
||||
if ((msg_loop & MSG_BOOST) != MSG_BOOST) {
|
||||
if (aq_data->boost == true) {
|
||||
LOG(ALLB_LOG,LOG_INFO, "Boost turned off\n");
|
||||
event_happened_set_device_state(BOOST_OFF, aq_data);
|
||||
// Add code to check Pump if to turn it on (was scheduled) ie time now is inbetween ON / OFF schedule
|
||||
}
|
||||
aq_data->boost = false;
|
||||
aq_data->boost_msg[0] = '\0';
|
||||
aq_data->boost_duration = 0;
|
||||
|
@ -420,7 +432,8 @@ void _processMessage(char *message, struct aqualinkdata *aq_data, bool reset)
|
|||
else if (stristr(msg, LNG_MSG_FREEZE_PROTECTION_ACTIVATED) != NULL)
|
||||
{
|
||||
msg_loop |= MSG_FREEZE;
|
||||
aq_data->frz_protect_state = default_frz_protect_state;
|
||||
//aq_data->frz_protect_state = default_frz_protect_state;
|
||||
aq_data->frz_protect_state = ON;
|
||||
//freeze_msg_count = 0;
|
||||
strcpy(aq_data->last_display_message, msg); // Also display the message on web UI
|
||||
}
|
||||
|
@ -502,6 +515,7 @@ void _processMessage(char *message, struct aqualinkdata *aq_data, bool reset)
|
|||
{
|
||||
//LOG(ALLBUTTON,LOG_NOTICE, "Standard protocol initialization complete\n");
|
||||
queueGetProgramData(ALLBUTTON, aq_data);
|
||||
event_happened_set_device_state(POWER_ON, aq_data);
|
||||
//queueGetExtendedProgramData(ALLBUTTON, aq_data, _aqconfig_.use_panel_aux_labels);
|
||||
_initWithRS = true;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "aqualink.h"
|
||||
#include "aq_scheduler.h"
|
||||
#include "config.h"
|
||||
#include "aq_panel.h"
|
||||
//#include "utils.h"
|
||||
|
||||
|
||||
|
@ -287,3 +288,47 @@ int build_schedules_js(char* buffer, int size)
|
|||
|
||||
return length;
|
||||
}
|
||||
|
||||
bool event_happened_set_device_state(reset_event_type type, struct aqualinkdata *aq_data)
|
||||
{
|
||||
// Check time is between hours.
|
||||
bool scheduledOn = false;
|
||||
|
||||
time_t now = time(NULL);
|
||||
struct tm *tm_struct = localtime(&now);
|
||||
|
||||
int hour = tm_struct->tm_hour;
|
||||
if (hour >= _aqconfig_.sched_chk_pumpon_hour && hour < _aqconfig_.sched_chk_pumpoff_hour ) {
|
||||
scheduledOn = true;
|
||||
}
|
||||
|
||||
// Check event type.
|
||||
switch(type){
|
||||
case POWER_ON:
|
||||
if (scheduledOn && _aqconfig_.sched_chk_poweron && aq_data->aqbuttons[0].led->state == OFF) {
|
||||
LOG(SCHD_LOG,LOG_INFO, "Powered on, schedule is set for pump running and pump is off, turning pump on\n");
|
||||
panel_device_request(aq_data, ON_OFF, 0, true, NET_TIMER);
|
||||
} else {
|
||||
LOG(SCHD_LOG,LOG_DEBUG, "Powered on, schedule is not set and/or pump is already on, leaving\n");
|
||||
}
|
||||
break;
|
||||
case FREEZE_PROTECT_OFF:
|
||||
if (scheduledOn && _aqconfig_.sched_chk_freezeprotectoff && aq_data->aqbuttons[0].led->state == OFF) {
|
||||
LOG(SCHD_LOG,LOG_INFO, "Freeze Protect off, schedule is set for pump running and pump is off, turning pump on\n");
|
||||
panel_device_request(aq_data, ON_OFF, 0, true, NET_TIMER);
|
||||
} else {
|
||||
LOG(SCHD_LOG,LOG_DEBUG, "Freeze Protect off, schedule is not set and/or pump is already on, leaving\n");
|
||||
}
|
||||
break;
|
||||
case BOOST_OFF:
|
||||
if (scheduledOn && _aqconfig_.sched_chk_boostoff && aq_data->aqbuttons[0].led->state == OFF) {
|
||||
LOG(SCHD_LOG,LOG_INFO, "Boost off, schedule is set for pump running and pump is off, turning pump on\n");
|
||||
panel_device_request(aq_data, ON_OFF, 0, true, NET_TIMER);
|
||||
} else {
|
||||
LOG(SCHD_LOG,LOG_DEBUG, "Boost off, schedule is not set and/or pump is already on, leaving\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,14 @@ typedef struct aqs_cron
|
|||
|
||||
int build_schedules_js(char* buffer, int size);
|
||||
int save_schedules_js(const char* inBuf, int inSize, char* outBuf, int outSize);
|
||||
|
||||
typedef enum reset_event_type{
|
||||
POWER_ON,
|
||||
FREEZE_PROTECT_OFF,
|
||||
BOOST_OFF
|
||||
} reset_event_type;
|
||||
|
||||
bool event_happened_set_device_state(reset_event_type type, struct aqualinkdata *aq_data);
|
||||
//void read_schedules();
|
||||
//void write_schedules();
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ typedef enum {
|
|||
NET_API,
|
||||
NET_WS,
|
||||
NET_DZMQTT,
|
||||
NET_TIMER, // Not used yet, need to change aq_timer.c
|
||||
NET_TIMER, // Timer or Scheduler (eg poweron/freezeprotect check)
|
||||
UNACTION_TIMER
|
||||
} request_source;
|
||||
|
||||
|
|
|
@ -155,6 +155,13 @@ void init_parameters (struct aqconfig * parms)
|
|||
#endif
|
||||
|
||||
parms->enable_scheduler = true;
|
||||
|
||||
parms->sched_chk_poweron = false;
|
||||
parms->sched_chk_freezeprotectoff = false;
|
||||
parms->sched_chk_boostoff = false;
|
||||
parms->sched_chk_pumpon_hour = 0;
|
||||
parms->sched_chk_pumpoff_hour = 0;
|
||||
|
||||
parms->ftdi_low_latency = true;
|
||||
parms->frame_delay = 0;
|
||||
parms->device_pre_state = true;
|
||||
|
@ -682,6 +689,21 @@ bool setConfigValue(struct aqualinkdata *aqdata, char *param, char *value) {
|
|||
} else if (strncasecmp (param, "enable_scheduler", 16) == 0) {
|
||||
_aqconfig_.enable_scheduler = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, "scheduler_check_poweron", 23) == 0) {
|
||||
_aqconfig_.sched_chk_poweron = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, "scheduler_check_freezeprotectoff", 32) == 0) {
|
||||
_aqconfig_.sched_chk_freezeprotectoff = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, "scheduler_check_boostoff", 24) == 0) {
|
||||
_aqconfig_.sched_chk_boostoff = text2bool(value);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, "scheduler_check_pumpon_hour", 27) == 0) {
|
||||
_aqconfig_.sched_chk_pumpon_hour = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, "scheduler_check_pumpoff_hour", 28) == 0) {
|
||||
_aqconfig_.sched_chk_pumpoff_hour = strtoul(value, NULL, 10);
|
||||
rtn=true;
|
||||
} else if (strncasecmp (param, "ftdi_low_latency", 16) == 0) {
|
||||
_aqconfig_.ftdi_low_latency = text2bool(value);
|
||||
rtn=true;
|
||||
|
|
|
@ -105,6 +105,11 @@ struct aqconfig
|
|||
bool mqtt_timed_update;
|
||||
bool sync_panel_time;
|
||||
bool enable_scheduler;
|
||||
bool sched_chk_poweron;
|
||||
bool sched_chk_freezeprotectoff;
|
||||
bool sched_chk_boostoff;
|
||||
int sched_chk_pumpon_hour;
|
||||
int sched_chk_pumpoff_hour;
|
||||
bool ftdi_low_latency;
|
||||
int frame_delay;
|
||||
bool device_pre_state;
|
||||
|
|
Loading…
Reference in New Issue