save temp_today in KVS
This commit is contained in:
parent
d072d29fba
commit
4d3fcd8826
20
pool.js
20
pool.js
@ -110,6 +110,13 @@ function update_new_day() {
|
|||||||
print("[POOL] KVS set temp_yesterday: ", JSON.stringify(result));
|
print("[POOL] KVS set temp_yesterday: ", JSON.stringify(result));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Shelly.call(
|
||||||
|
"KVS.Set",
|
||||||
|
{ key: "pool.temp_today", value: null },
|
||||||
|
function (result) {
|
||||||
|
print("[POOL] KVS set temp_today: ", JSON.stringify(result));
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// call a chain of API calls
|
// call a chain of API calls
|
||||||
@ -220,7 +227,18 @@ function update_temp(temp) {
|
|||||||
status.lock_update = true;
|
status.lock_update = true;
|
||||||
|
|
||||||
status.temp = Math.round(temp * 10) / 10;
|
status.temp = Math.round(temp * 10) / 10;
|
||||||
status.temp_today = Math.max(status.temp_today, status.temp);
|
|
||||||
|
if (status.temp > status.temp_today || status.temp_today === null) {
|
||||||
|
status.temp_today = status.temp;
|
||||||
|
Shelly.call (
|
||||||
|
"KVS.Set",
|
||||||
|
{ key: "pool.temp_today", value: status.temp_today },
|
||||||
|
function (result) {
|
||||||
|
print("[POOL] KVS set temp_today: ", JSON.stringify(result));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
status.temp_max = Math.max(status.temp_today, status.temp_yesterday);
|
status.temp_max = Math.max(status.temp_today, status.temp_yesterday);
|
||||||
|
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user