Rule Examples: различия между версиями

Нет описания правки
(Новая страница: «{{DISPLAYTITLE: Примеры правил}} === Слежение за контролом === <!--T:20--> <!--T:21--> Это простейшее правило…»)
 
Строка 80: Строка 80:
<syntaxhighlight lang="ecmascript">
<syntaxhighlight lang="ecmascript">


<!--T:39-->
var motion_timer_1_timeout_ms = 30 * 1000;
var motion_timer_1_timeout_ms = 30 * 1000;
var motion_timer_1_id = null;
var motion_timer_1_id = null;


<!--T:40-->
defineRule("motion_detector_1", {
defineRule("motion_detector_1", {
   whenChanged: "wb-gpio/D2_IN",
   whenChanged: "wb-gpio/D2_IN",
Строка 91: Строка 89:
         dev["wb-gpio"]["Relay_1"] = 1;
         dev["wb-gpio"]["Relay_1"] = 1;


      <!--T:41-->
if (motion_timer_1_id) {
if (motion_timer_1_id) {
           clearTimeout(motion_timer_1_id);
           clearTimeout(motion_timer_1_id);
Строка 103: Строка 100:
   }
   }
});
});
<!--T:42-->
</syntaxhighlight>
</syntaxhighlight>


=== Создание однотипных правил === <!--T:43-->
=== Создание однотипных правил === <!--T:43-->