-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto_heating.js
38 lines (31 loc) · 1.07 KB
/
auto_heating.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* @name BalkHeat
* @desc
* @version 4
*/
const STEMP10 = Device("STEMP10","Port", "byte",[
{"name":"work", "note":"Поддерживать автоматически", "type":"cb", "val":0},
{"name":"temp", "note":"Поддерживать температуру", "type":"number", "val":23},
{"name":"gist", "note":"Гистерезис", "type":"number", "val":3}
]);
const RADIATOR1 = Device("RADIATOR1");
startOnChange(STEMP10);
script({
dif:0,
start() {
this.log(STEMP10.getParam("work"));
if (STEMP10.getParam("work") !== true)
{
return false;
}
this.dif=STEMP10.getParam("temp")-STEMP10.value;
if (STEMP10.value < (STEMP10.getParam("temp")-STEMP10.getParam("gist")) && (RADIATOR1.isOff())){
this.log("r1on");
RADIATOR1.on();
}
if (STEMP10.value >= (STEMP10.getParam("temp")+STEMP10.getParam("gist")) && (RADIATOR1.isOn())){
this.log("r1off");
RADIATOR1.off();
}
}
});