I have a simple rule to send a message in case a water leak is detected. I would like to repeat the message every 10 minutes as long as the leak condition is present, or until 12 messages have been sent, whichever happens earlier. So I have "Repeat 12 times every 10 minutes (Stop)" in the actions for true.
The rule works as expected most of the time. But sometimes it gets stuck in a (false)(repeating) state after the leak condition is cleared. In this state it will continue to send messages every 10 minutes until 12 messages have been sent. This seems to happen only when the leak sensor changes state between wet and dry too close together (which might happen when wiping the sensor to dry it).
Here is a screenshot of the RM app in the incorrect state:
Here is the events page from the leak sensor. The RM app went to the incorrect state around 5:56:05 after several rapid state transitions in the sensor state. I could restore the app to the correct state at 06:33:25 by creating a single wet / dry transition.
Appreciate any help / tips to further debug this. Thanks!
Edit: I should add that I have the original C-4 hub on firmware version 184.108.40.206. The leak sensor is a Smartthings device using the Generic Zigbee Moisture Sensor driver.
You're going to run into trouble when your sensor changes state that quickly. I had lost events when a sensor changed 4 times in rapid succession, so fast that the cancel missed one and it ended up in the wrong truth state. What you might want to do is add a delay of 10 seconds with truth change built in. That might solve the problem of having it not know the correct state. However, that means you would get a "dry notification when you never went to wet. My question is though, why notify when it's dry? that doesn't mean that the leak solved it self. If it's become wet that means there's a leak and someone has to do something, right?
Point taken about events that are too close together being missed or being received out of order, and ending up in the wrong state as a result. But in this case I see the events made it into Rule Machine in the correct order (see snapshot below).
I could put in the 10 seconds delay as you suggest, with cancel on truth change. But RM seems to be ignoring the stop on truth change in the current set-up -- so I imagine it will also ignore the cancel on truth change.
(The "dry notification" is nice to have -- for instance if I'm away from home but someone else is home and took care of the leak.)
Here is a snapshot from the rule's events page. It shows that the last event at 05:56:05 was "water dry", and the rule correctly transitioned into the False state at 05:56:06. But it continued with the repeating action.
I will play around some more tonight to see if the issue is reproducible.
Do you have the stop action in the false for "THIS RULE"? It will be at the top of the list.
I don't have anything in the stop action part of the false.
I think I now understand what you were suggesting. I can put a stop action for "THIS RULE" with a delay of, say, 1 minute. Then the rule will stop executing upon false, even if it gets into the "(false)(repeating)" state. Something like a belt-and-suspenders approach.
Will give it a try. Thanks for the suggestion!