Hey everyone - I'm trying to create a rule and I can't get what I'm after, since part of it depends on a contact sensor being closed for at least 1 minute.
Here's what I want to happen - when my ecolink motion sensor is inactive, and my basement door contact sensor has been closed for at least one minute, when my basement motion sensor becomes active, I want to send a message.
The part that I'm getting stuck on is the contact sensor being closed for at least one minute, as it seems I can only use the "and stays" logic for the contact sensor in the trigger section, but I want the trigger only to be when the basement motion sensor goes active (when ecolink is inactive, and the basement door contact sensor has been closed for at least 1 min).
I want the message to be sent however many times the basement motion sensor goes active during these conditions.
There will be a neater solution than this, but you could:
Setup a Virtual Switch that you turn on and off via one Rule based on your contact sensor being closed for one minute (trigger on closed for 1 minute, turn switch on, wait for contact to close and turn the switch off).
Create a second rule to have a required expression of the switch being on, trigger by the motion sensor becoming active, with an action to send a notification (or whatever else you want).
I confirmed this does what I need - thank you! Do you know why the "stays" logic can only be used in the trigger section of a rule (at least I believe that is the case)?
The short answer is (I think) that "stays" is still really an event, a moment in time where the device has been open for exactly 10 minutes. A Required Expression needs to be something that can be evaluated at any time. Think of it like Rule Machine asking the device "are you currently open?", or "what is your current temperature?". These are both things a device can provide an answer to based on the data they keep. They don't (natively) store how long they have been open for, that is why we have to engineer that ourselves through the use of the state of the virtual switch.
Seems to make sense. Just a bit surprised I can't do all within a single RM rule (or perhaps I can with the feedback pseudonym provided?), as I was able to do this with ST, as well as with WebCore (before ST killed WebCore). RM is very WebCore-ish, IMO, which I feel is a good thing - very powerful. I am still learning, and I appreciate your feedback.
Yeah I can't claim to know all the tricks, just enough to cover most of my needs and a few things I remember from here on the Community. There's always something new and clever to discover (and being added to RM).