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

(Новая страница: «if (relay_down_timer_id) { relay_down_timer_id = clearTimeout(relay_down_timer_id); };»)
(Новая страница: «defineRule("water_meter_1", { whenChanged: "wb-mcm8_29/Input 1 counter", then: function(newValue, devName, cellName) { if(newValue){ dev["water_meters"]["water_meter_1"] = ((parseInt(newValue) - counterCorrection) * inpulseValue) + meterCorrection; // We multiply the value of the counter by the number of liters / pulse and add the correction value. } } }); </syntaxhighlight>»)
Строка 292: Строка 292:
});
});


<div lang="ru" dir="ltr" class="mw-content-ltr">
defineRule("water_meter_1", {
defineRule("water_meter_1", {
     whenChanged: "wb-mcm8_29/Input 1 counter",
     whenChanged: "wb-mcm8_29/Input 1 counter",
     then: function(newValue, devName, cellName) {
     then: function(newValue, devName, cellName) {
       if(newValue){
       if(newValue){
       dev["water_meters"]["water_meter_1"] = ((parseInt(newValue) - counterCorrection) * inpulseValue) + meterCorrection; // Умножаем значение счетчика на количество литров/импульс и прибавляем корректировочное значение.
       dev["water_meters"]["water_meter_1"] = ((parseInt(newValue) - counterCorrection) * inpulseValue) + meterCorrection; // We multiply the value of the counter by the number of liters / pulse and add the correction value.
       }
       }
     }
     }
});
});
</syntaxhighlight>
</syntaxhighlight>
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
<div lang="ru" dir="ltr" class="mw-content-ltr">