I am trying to do a simple thing .. when a PIR triggers, save the current dimmer value and increase the dimmer to 100. After a delay revert to the original dimmer value. I have this code ..
Capture: Study Downlights
Dim: Study Downlights: 100 --> fade: 0
On: Study Downlights
Delay 0:00:20
Restore: Study Downlights
Which works fine unless the PIR triggers again during the delay. In this case the rule runs again and the Capture value is 100, Consequently the original dimmer value is lost and the lights never return to the original value.
What I need is a way to stop the rule running again until it has completed the first time (and therefore restored the original value in the dimmer).
Thank you for your reply. If I use Private Boolean how do I ensure it is set true initially? If it was false when the RM started the rule would never be triggered?
Also, should the Private Boolean test be in the trigger condition or a conditional at the beginning of the Actions?
Thanks again for your help, I have never visited a forum with such helpful and polite comments.
PB always start out as being true (when first created). And in your rule, your actions would be something like:
Set Private Boolean False
Capture: Study Downlights
Dim: Study Downlights: 100 --> fade: 0
On: Study Downlights
Delay 0:00:20
Restore: Study Downlights
Set Private Boolean True
So when the rule is done running, the PB is True again for the next time the rule is triggered.
This. Doing so prevents the rule from being triggered when the PB is False.
The only circumstance that will leave the PB in a False state is if your hub was rebooted or froze while the rule was still being run. To circumvent this, create a second rule that sets the PB for this rule to be true when the hub is restarted. The trigger for a restart is the location event "SystemStart".