Creating a rule trigger for state change rather than current state


Hi - I want to create a trigger in RM based on a contact sensor for a door opening - but I don't want it to trigger when the door just stays open. Does the regular contact trigger already have this built in - ie that it triggers on a change from closed to open?

The action will be to turn a light on. If I manually turn the light off but the door remains open, will the rule turn the light back on? If so, how do you require a change from previous state?

A contact sensor only has two possible states, open or closed. If you get an "open" event, that means it was closed, and therefore there was a change.

So, I suppose I don't understand your question. Can you either re-phrase it or provide an example of a rule you've created? (Of course, if you do the latter, you can also test it to see if it already works how you want. Enable all logging and check Logs to get the most possible information from your setup.)

No, it will only turn on from the event of opening. See this article to learn more about events and conditions:

1 Like

Thanks. The part that has confused me in the past is there are other things I thought would operate as events but didn't. I believe had an issue with Room Lighting a while back where one of the things that would activate the app was luminance falling below a certain value. If I remember right, that continued to trigger as long as it stayed below the value vs triggering only when it went from above to below the threshold.

Each new report of illuminance is a new event. Room Lighting has features to cause it not to turn on the lights if they are already on. But if they are turned on by an illuminance event, and then you turn them off, a new illuminance event below the certain value would turn them on again. There are ways to get around this, if you only want the very first event to cause an action, and no subsequent events, but this will be a bit more complicated to do.

Contrast that to a contact sensor though: there are only two possible states, open and close, so remaining open can never be an event -- unlike illuminance that has a multitude of possible states.

1 Like

Thank you for the explanation. That makes sense. I'd be interested in how one would prevent retriggering in situations where there are continued events after passing a threshold (illuminance, temperature, etc). Is there a write up somewhere already you could point me to?