Translations:Rule Examples/225/en

Материал из Wiren Board
Версия от 20:52, 21 сентября 2022; Matveevrj (обсуждение | вклад) (Новая страница: «var hysteresis = 0.5; function Termostat(name, temp, setpoint, TS, TS_onoff) { defineRule(name, { whenChanged: temp, //when the sensor state changes then: function (newValue, devName, cellName) { // do the following if (dev[TS_onoff]) { if ( newValue < dev[setpoint] - hysteresis) { //if the sensor temperature is less than the setpoint - hysteresis dev[TS] = true; } if ( newValue > dev[setpoint] + hysteresis) { //if the sensor temper...»)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)

var hysteresis = 0.5; function Termostat(name, temp, setpoint, TS, TS_onoff) { defineRule(name, {

 whenChanged: temp, //when the sensor state changes
 then: function (newValue, devName, cellName) { // do the following
   if (dev[TS_onoff]) {
   if ( newValue < dev[setpoint] - hysteresis) { //if the sensor temperature is less than the setpoint - hysteresis
     dev[TS] = true;
   }
   if ( newValue > dev[setpoint] + hysteresis) { //if the sensor temperature is greater than the virtual setpoint + hysteresis
     dev[TS] = false;
   }
   }
   else dev[TS] = false;
 }

}); }