use synchronous call to read system time
This commit is contained in:
parent
4b968ca944
commit
d7c56585b4
15
pool.js
15
pool.js
@ -241,11 +241,7 @@ 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);
|
||||||
|
|
||||||
Shelly.call (
|
let time = Shelly.getComponentStatus("sys").time; // "HH:MM"
|
||||||
"Sys.GetStatus",
|
|
||||||
{},
|
|
||||||
function (result) {
|
|
||||||
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)
|
||||||
@ -263,8 +259,6 @@ function update_temp(temp) {
|
|||||||
else {
|
else {
|
||||||
print("[POOL] no temp change, skip update_pump");
|
print("[POOL] no temp change, skip update_pump");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
status.lock_update = false;
|
status.lock_update = false;
|
||||||
}
|
}
|
||||||
@ -341,15 +335,10 @@ Timer.set(
|
|||||||
true,
|
true,
|
||||||
function() {
|
function() {
|
||||||
status.tick++;
|
status.tick++;
|
||||||
Shelly.call (
|
let result = Shelly.getComponentStatus("sys");
|
||||||
"Sys.GetStatus",
|
|
||||||
{},
|
|
||||||
function (result) {
|
|
||||||
print("[POOL] tick", result.time);
|
print("[POOL] tick", result.time);
|
||||||
status.time = result.time;
|
status.time = result.time;
|
||||||
status.uptime = result.uptime;
|
status.uptime = result.uptime;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user