Compare commits
2 Commits
0971368482
...
2014350bc7
Author | SHA1 | Date | |
---|---|---|---|
2014350bc7 | |||
5c7b06ff86 |
55
pool.js
55
pool.js
@ -28,12 +28,22 @@ let status = {
|
|||||||
|
|
||||||
// temperature->duration chart
|
// temperature->duration chart
|
||||||
let filt_time = [
|
let filt_time = [
|
||||||
[ 5, 1.0 ], // at 5°C, 1 hour of filtering
|
[ 5, 2.0 ], // at 5°C, 2 hours of filtering
|
||||||
[ 10, 2.0 ],
|
[ 8, 3.0 ],
|
||||||
[ 12, 4.0 ],
|
[ 10, 4.0 ],
|
||||||
[ 16, 6.0 ],
|
[ 11, 5.0 ],
|
||||||
[ 24, 8.0 ],
|
[ 12, 6.0 ],
|
||||||
[ 27, 12.0 ],
|
[ 14, 7.0 ],
|
||||||
|
[ 16, 8.0 ],
|
||||||
|
[ 18, 9.0 ],
|
||||||
|
[ 20, 10.0 ],
|
||||||
|
[ 22, 11.0 ],
|
||||||
|
[ 24, 12.0 ],
|
||||||
|
[ 25, 14.0 ],
|
||||||
|
[ 26, 17.0 ],
|
||||||
|
[ 27, 20.0 ],
|
||||||
|
[ 28, 22.0 ],
|
||||||
|
[ 29, 23.0 ],
|
||||||
[ 30, 24.0 ]
|
[ 30, 24.0 ]
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -62,23 +72,17 @@ function compute_filtration_time(t) {
|
|||||||
// [ start1, stop1, start2, stop2, ... ]
|
// [ start1, stop1, start2, stop2, ... ]
|
||||||
|
|
||||||
function compute_schedule_filt(d) {
|
function compute_schedule_filt(d) {
|
||||||
let s = null;
|
let start = 17 - d/2;
|
||||||
if (d < 2) {
|
let stop = 17 + d/2;
|
||||||
s = [ 9, 9+d ];
|
|
||||||
} else if (d < 8) {
|
while (stop >= 24)
|
||||||
s = [ 9, 10, 14, 14+d-1 ];
|
stop = stop - 24;
|
||||||
} else if (d < 11) {
|
|
||||||
s = [ 9, 11, 14, 14+d-2 ];
|
if (d < 24) {
|
||||||
} else if (d < 14) {
|
let s = [ start, stop ];
|
||||||
s = [ 9, 9+d-9, 14, 23];
|
}
|
||||||
} else if (d < 15) {
|
else {
|
||||||
s = [ 9, 9+d ];
|
let s = [ start ];
|
||||||
} else if (d < 18) {
|
|
||||||
s = [ 24-d, 0 ];
|
|
||||||
} else if (d < 24) {
|
|
||||||
s = [ 6, d-18 ];
|
|
||||||
} else {
|
|
||||||
s = [ 6 ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
@ -295,7 +299,10 @@ MQTT.subscribe(
|
|||||||
"zigbee2mqtt/Piscine",
|
"zigbee2mqtt/Piscine",
|
||||||
function (topic, msg) {
|
function (topic, msg) {
|
||||||
status.tick_mqtt++;
|
status.tick_mqtt++;
|
||||||
print("[POOL] mqtt", topic);
|
print("[POOL] mqtt", topic, msg);
|
||||||
|
if (msg == "") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let obj = JSON.parse(msg);
|
let obj = JSON.parse(msg);
|
||||||
if (obj.temperature === undefined) {
|
if (obj.temperature === undefined) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user