Debouncing a rule


Hi, Iā€™ve been struggling this this RM rule which produces two notifications for every time it runs. Iā€™ve not tracked down the root cause yet, but suspect this is to do with the actual on and off events from the driver controlling the AC (a Sensibo). Is there a straight forward way to debounce this logic? So that It can only run once within a defined period of time? Thanks!

By debounce do you mean preventing the rule from running multiple times concurrently? If so, then yes... you can use the private boolean to do that. See example. You could also add a delay in the rule to set a period of time during which the rule cannot run again. See @neonturboā€˜s comment below though. Much better off figuring out why the thing is sending multiple notifications if you can.

2 Likes

Could it be possible that it is the trigger rather than the rule causing this? Some sensors are known to send multiple events, which would then trigger the rule multiple times.

Maybe turn on all logging, and see if you can spot where the repeat happens...

5 Likes

Logging would be good but perhaps a simple wait for event elapsed time of 5 seconds at the beginning would be a good idea. That way if the rule triggers multiple times it should stop at the wait, and not continue until no additional triggers occur.

A contact sensor may change multiple times when opened. I had a closet door sensor that did that. In that case adjusting the gap between the magnet and sensor stopped it, but it would cause multiple triggers each time I opened the door.

4 Likes

Thanks for the help with this - got the private boolean set up working whilst I try and debug whatā€™s going on. Thanks again!

1 Like