Translations:Rule Examples/219/en

Материал из Wiren Board

When the CO2 concentration is over 1001, we flash red once a second.

<syntaxhighlight lang="ecmascript"> defineRule("msw3_co2", {

   whenChanged: "wb-msw-v3_97/CO2",
   then: function(newValue, devName, cellName) {
       var co2_good = newValue < 650;
       var co2_middle = newValue < 1000 && newValue > 651;
       var co2_bad = newValue > 1001;