more monitoring

This commit is contained in:
Gilles Grandou 2022-04-23 16:28:31 +02:00
parent a490593a24
commit eb8584a576
1 changed files with 12 additions and 2 deletions

14
pool.js
View File

@ -13,9 +13,14 @@ let status = {
disable_temp: null, disable_temp: null,
lock_update: false, lock_update: false,
duration: null,
schedule: null,
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,
}; };
@ -124,6 +129,9 @@ function update_pump(temp, max, time) {
print("[POOL] update_pump - duration:", duration); print("[POOL] update_pump - duration:", duration);
print("[POOL] update_pump - schedule:", JSON.stringify(schedule)); print("[POOL] update_pump - schedule:", JSON.stringify(schedule));
status.duration = duration;
status.schedule = schedule;
let calls = []; let calls = [];
calls.push({method: "Schedule.DeleteAll", params: null}); calls.push({method: "Schedule.DeleteAll", params: null});
@ -209,7 +217,8 @@ function update_temp(temp) {
status.update_temp_max_last = status.temp_max; status.update_temp_max_last = status.temp_max;
} }
else { else {
print("[POOL] to much update_pump, skipped"); status.tick_pump_skip++;
print("[POOL] to much update_pump, skipped", status.tick_pump_skip);
} }
} }
} }
@ -244,7 +253,8 @@ MQTT.subscribe(
Shelly.addEventHandler( Shelly.addEventHandler(
function (data) { function (data) {
if (data.info.event === "toggle") { if (data.info.event === "toggle") {
print("[POOL] disable temp"); status.tick_lock++;
print("[POOL] disable temp", status.tick_lock);
if (status.disable_temp !== null) if (status.disable_temp !== null)
Timer.clear(status.disable_temp); Timer.clear(status.disable_temp);