Add once example

Theo Arends 2018-04-26 17:51:19 +02:00
parent ad374e4e6f
commit 9a211a08fe
1 changed files with 15 additions and 1 deletions

@ -126,3 +126,17 @@ Result
- When the timer expires the rule kicks in and set Power1 to OFF, Power2 to ON and Toggles Power3 - When the timer expires the rule kicks in and set Power1 to OFF, Power2 to ON and Toggles Power3
If you want to have blink functionality define a rule like ``on clock#timer=3 do power 3 endon`` If you want to have blink functionality define a rule like ``on clock#timer=3 do power 3 endon``
#### 4. Usage of one-shot (once)
The once option (``rule 4/5/6``) provides the possibility to trigger on a slow change while the change is still within the bounds of the test.
Rule
- ``on ENERGY#Current>0.100 do publish tool/tablesaw/power 1 endon on ENERGY#Current<0.100 do publish tool/tablesaw/power 0 endon``
This creates a rule to publish MQTT commands whenever a Sonoff POW has current passing through it. Used as is, it will publish MQTT commands repeatedly, over and over, while current is >0.100 ... but, executing another command:
``Rule 5``
Now the MQTT message will be sent once, and only once, while the condition is met. This is perfect for thermostat on/off depending on temperature, bathroom extractor fan on/off depending on humidity, workshop dust collector on/off depending on whether some dust-producing machine is running.
It meets the 'hard thermostat' requests that have been common.