use synchronous call to read system time

This commit is contained in:
Gilles Grandou 2022-11-02 17:22:03 +01:00
parent 4b968ca944
commit d7c56585b4
1 changed files with 18 additions and 29 deletions

15
pool.js
View File

@ -241,11 +241,7 @@ 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"
let time = Shelly.getComponentStatus("sys").time; // "HH:MM"
print("[POOL] time", time);
// compute current time in float format (12h45 -> 12.75)
@ -263,8 +259,6 @@ function update_temp(temp) {
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) {
let result = Shelly.getComponentStatus("sys");
print("[POOL] tick", result.time);
status.time = result.time;
status.uptime = result.uptime;
}
);
}
);