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

Нет описания правки
Строка 81: Строка 81:
<!--T:38-->
<!--T:38-->
<syntaxhighlight lang="ecmascript">
<syntaxhighlight lang="ecmascript">
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;
Строка 89: Строка 88:
   then: function (newValue, devName, cellName) {
   then: function (newValue, devName, cellName) {
     if (newValue) {
     if (newValue) {
       dev["wb-gpio"]["Relay_1"] = 1;
       dev["wb-gpio"]["Relay_1"] = true;
 
       if (motion_timer_1_id) {
       if (motion_timer_1_id) {
         clearTimeout(motion_timer_1_id);
         clearTimeout(motion_timer_1_id);
       }
       }
 
    } else {
       motion_timer_1_id = setTimeout(function () {
       motion_timer_1_id = setTimeout(function () {
         dev["wb-gpio"]["Relay_1"] = 0;
         dev["wb-gpio"]["Relay_1"] = false;
         motion_timer_1_id = null;
         motion_timer_1_id = null;
       }, motion_timer_1_timeout_ms);
       }, motion_timer_1_timeout_ms);