12 063
правки
(Новая страница: «defineRule("heater_control", { //rule name is arbitrary whenChanged: "wb-w1/28-0115a48fcfff", //when the state of 1-Wire sensor with ID 28-0115a48fcfff changes…») |
(Новая страница: «</syntaxhighlight> *The first line is the code word ''defineRule'' and the name of the rule *The second line is the code word for determining when the rule is exe…») |
||
Строка 46: | Строка 46: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* | *The first line is the code word ''defineRule'' and the name of the rule | ||
* | *The second line is the code word for determining when the rule is executed-whenChanged - "when the parameter changes", then the name of the parameter, when changing which the rule will start - the temperature from the 1-Wire sensor. The parameter name is written as "Device/Control", where the device and Control names for each parameter can be found on the Settings page of the web interface in the ''MQTT Channels'' table. | ||
* | *The third line is the beginning of the function to be executed | ||
* | *Then there is a condition - "if the temperature is greater than the threshold, then ...". The value of the parameter is written as dev[Device][Control] - note that it differs from the type of parameter recording, when changing which the rule is run, because there it is a parameter, and here - the value of the same parameter. | ||
* | *Then we set the values for the relay in each case - 0 - "off", 1 - "on". The names of the Device and Control for the relay look all in the same table MQTT Channels on the ''Settings'' page of the web interface. | ||
правки