pool: new day fix
This commit is contained in:
parent
2b6652411a
commit
f3c444d0de
52
pool.js
52
pool.js
@ -198,39 +198,37 @@ function update_temp(temp) {
|
|||||||
|
|
||||||
print("[POOL] update_temp - max:", status.temp_max, "today:", status.temp_today, "yesterday:", status.temp_yesterday);
|
print("[POOL] update_temp - max:", status.temp_max, "today:", status.temp_today, "yesterday:", status.temp_yesterday);
|
||||||
|
|
||||||
if (status.temp_max !== status.update_temp_max_last) {
|
Shelly.call (
|
||||||
Shelly.call (
|
"Sys.GetStatus",
|
||||||
"Sys.GetStatus",
|
{},
|
||||||
{},
|
function (result) {
|
||||||
function (result) {
|
let time = result.time; // "HH:MM"
|
||||||
let time = result.time; // "HH:MM"
|
print("[POOL] time", time);
|
||||||
print("[POOL] time", time);
|
|
||||||
|
|
||||||
// compute current time in float format (12h45 -> 12.75)
|
// compute current time in float format (12h45 -> 12.75)
|
||||||
let t = JSON.parse(time.slice(0,2)) + JSON.parse(time.slice(3,5)) / 60;
|
let t = JSON.parse(time.slice(0,2)) + JSON.parse(time.slice(3,5)) / 60;
|
||||||
|
|
||||||
if (t < status.update_time)
|
if (t < status.update_time)
|
||||||
update_new_day();
|
update_new_day();
|
||||||
|
|
||||||
status.update_time = t;
|
status.update_time = t;
|
||||||
|
|
||||||
if (status.temp_max !== null) {
|
if ((status.temp_max !== null) && (status.temp_max !== status.update_temp_max_last)) {
|
||||||
if ((t - status.update_time_last) > 0.15) { // 9 minutes
|
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_time_last = t;
|
||||||
status.update_temp_max_last = status.temp_max;
|
status.update_temp_max_last = status.temp_max;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
status.tick_pump_skip++;
|
status.tick_pump_skip++;
|
||||||
print("[POOL] to much update_pump, skipped", status.tick_pump_skip);
|
print("[POOL] to much update_pump, skipped", status.tick_pump_skip);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
else {
|
||||||
}
|
print("[POOL] no temp change, skip update_pump");
|
||||||
else {
|
}
|
||||||
print("[POOL] no temp change, skip update_pump");
|
}
|
||||||
}
|
);
|
||||||
|
|
||||||
status.lock_update = false;
|
status.lock_update = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user