|
|
|
@ -241,30 +241,24 @@ function update_temp(temp) {
|
|
|
|
|
|
|
|
|
|
print("[POOL] update_temp - max:", status.temp_max, "today:", status.temp_today, "yesterday:", status.temp_yesterday);
|
|
|
|
|
|
|
|
|
|
Shelly.call (
|
|
|
|
|
"Sys.GetStatus",
|
|
|
|
|
{},
|
|
|
|
|
function (result) {
|
|
|
|
|
let time = result.time; // "HH:MM"
|
|
|
|
|
print("[POOL] time", time);
|
|
|
|
|
let time = Shelly.getComponentStatus("sys").time; // "HH:MM"
|
|
|
|
|
print("[POOL] time", time);
|
|
|
|
|
|
|
|
|
|
// compute current time in float format (12h45 -> 12.75)
|
|
|
|
|
let t = JSON.parse(time.slice(0,2)) + JSON.parse(time.slice(3,5)) / 60;
|
|
|
|
|
// compute current time in float format (12h45 -> 12.75)
|
|
|
|
|
let t = JSON.parse(time.slice(0,2)) + JSON.parse(time.slice(3,5)) / 60;
|
|
|
|
|
|
|
|
|
|
if (t < status.update_time)
|
|
|
|
|
update_new_day();
|
|
|
|
|
if (t < status.update_time)
|
|
|
|
|
update_new_day();
|
|
|
|
|
|
|
|
|
|
status.update_time = t;
|
|
|
|
|
status.update_time = t;
|
|
|
|
|
|
|
|
|
|
if ((status.temp_max !== null) && (status.temp_max !== status.update_temp_max_last)) {
|
|
|
|
|
update_pump(status.temp, status.temp_max, t);
|
|
|
|
|
status.update_temp_max_last = status.temp_max;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
print("[POOL] no temp change, skip update_pump");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
if ((status.temp_max !== null) && (status.temp_max !== status.update_temp_max_last)) {
|
|
|
|
|
update_pump(status.temp, status.temp_max, t);
|
|
|
|
|
status.update_temp_max_last = status.temp_max;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
print("[POOL] no temp change, skip update_pump");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
status.lock_update = false;
|
|
|
|
|
}
|
|
|
|
@ -341,15 +335,10 @@ Timer.set(
|
|
|
|
|
true,
|
|
|
|
|
function() {
|
|
|
|
|
status.tick++;
|
|
|
|
|
Shelly.call (
|
|
|
|
|
"Sys.GetStatus",
|
|
|
|
|
{},
|
|
|
|
|
function (result) {
|
|
|
|
|
print("[POOL] tick", result.time);
|
|
|
|
|
status.time = result.time;
|
|
|
|
|
status.uptime = result.uptime;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
let result = Shelly.getComponentStatus("sys");
|
|
|
|
|
print("[POOL] tick", result.time);
|
|
|
|
|
status.time = result.time;
|
|
|
|
|
status.uptime = result.uptime;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|