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

Материал из Wiren Board
(Импортирована новая версия из внешнего источника)
 
(Импортирована новая версия из внешнего источника)
 
Строка 7: Строка 7:
     if ((date > date_start) && (date < date_end)) {
     if ((date > date_start) && (date < date_end)) {
       if (newValue) {
       if (newValue) {
           dev["wb-gpio"]["EXT1_R3A1"] = 1;
           dev["wb-gpio/EXT1_R3A1"] = 1;
    
    
           if (motion_timer_1_id) {
           if (motion_timer_1_id) {
Строка 14: Строка 14:
    
    
           motion_timer_1_id = setTimeout(function () {
           motion_timer_1_id = setTimeout(function () {
             dev["wb-gpio"]["EXT1_R3A1"] = 0;             
             dev["wb-gpio/EXT1_R3A1"] = 0;             
             motion_timer_1_id = null;
             motion_timer_1_id = null;
           }, motion_timer_1_timeout_ms);               
           }, motion_timer_1_timeout_ms);               

Текущая версия на 21:46, 21 сентября 2022

Определение сообщения (Rule Examples)
// time point marking the end of the interval
   var date_end = new Date(date);
   date_end.setHours(17);
   date_end.setMinutes(10);
    
   // if time is between 09:30 and 17:10 UTC
   if ((date > date_start) && (date < date_end)) {
     if (newValue) {
         dev["wb-gpio/EXT1_R3A1"] = 1;
   
         if (motion_timer_1_id) {
           clearTimeout(motion_timer_1_id);
         }
   
         motion_timer_1_id = setTimeout(function () {
             dev["wb-gpio/EXT1_R3A1"] = 0;           
             motion_timer_1_id = null;
         }, motion_timer_1_timeout_ms);             
     }
     }
   }
});
</syntaxhighlight>

// time point marking the end of the interval

   var date_end = new Date(date);
   date_end.setHours(17);
   date_end.setMinutes(10);
   
   // if time is between 09:30 and 17:10 UTC
   if ((date > date_start) && (date < date_end)) {
     if (newValue) {
         dev["wb-gpio/EXT1_R3A1"] = 1;
  
         if (motion_timer_1_id) {
           clearTimeout(motion_timer_1_id);
        }
  
         motion_timer_1_id = setTimeout(function () {
            dev["wb-gpio/EXT1_R3A1"] = 0;            
            motion_timer_1_id = null;
         }, motion_timer_1_timeout_ms);              
     }
    }
  }

}); </syntaxhighlight>