remove all update disables

This commit is contained in:
Gilles Grandou 2022-10-31 15:16:28 +01:00
parent c927997d69
commit e1f6561331

40
pool.js
View File

@ -7,10 +7,8 @@ let status = {
temp_yesterday: null, temp_yesterday: null,
update_time: null, update_time: null,
update_time_last: 0,
update_temp_max_last: null, update_temp_max_last: null,
disable_temp: null,
lock_update: false, lock_update: false,
duration: null, duration: null,
@ -22,9 +20,7 @@ let status = {
tick: 0, tick: 0,
tick_mqtt: 0, tick_mqtt: 0,
tick_temp: 0, tick_temp: 0,
tick_lock: 0,
tick_pump: 0, tick_pump: 0,
tick_pump_skip: 0,
tick_day: 0, tick_day: 0,
}; };
@ -215,11 +211,6 @@ function update_temp(temp) {
print("[POOL] update_temp", status.tick_temp, temp); print("[POOL] update_temp", status.tick_temp, temp);
if (status.disable_temp !== null) {
print("[POOL] update disabled");
return;
}
if (status.lock_update) { if (status.lock_update) {
print("[POOL] update_temp locked"); print("[POOL] update_temp locked");
return; return;
@ -259,16 +250,9 @@ function update_temp(temp) {
status.update_time = t; status.update_time = t;
if ((status.temp_max !== null) && (status.temp_max !== status.update_temp_max_last)) { if ((status.temp_max !== null) && (status.temp_max !== status.update_temp_max_last)) {
if ((t - status.update_time_last) > 0.15) { // 9 minutes
update_pump(status.temp, status.temp_max, t); update_pump(status.temp, status.temp_max, t);
status.update_time_last = t;
status.update_temp_max_last = status.temp_max; status.update_temp_max_last = status.temp_max;
} }
else {
status.tick_pump_skip++;
print("[POOL] to much update_pump, skipped", status.tick_pump_skip);
}
}
else { else {
print("[POOL] no temp change, skip update_pump"); print("[POOL] no temp change, skip update_pump");
} }
@ -319,30 +303,6 @@ MQTT.subscribe(
} }
) )
// after a Switch Event, disable temp update
// during 10 minutes
Shelly.addEventHandler(
function (data) {
if (data.info.event === "toggle") {
status.tick_lock++;
print("[POOL] disable temp", status.tick_lock);
if (status.disable_temp !== null)
Timer.clear(status.disable_temp);
status.disable_temp = Timer.set(
600 * 1000,
false,
function () {
print("[POOL] re-enable temp");
status.disable_temp = null;
}
);
}
}
);
// Debug... // Debug...
Timer.set( Timer.set(