Time thresholds (if door is open for 5 minutes, etc...) for rules in RM4?

So RM4 has been a mystery for me. I am a programmer, and engineer and RM4 is just a wacky thing compared to how straightforward RM1 -3 was.

So I have some simple things I need to get done with some new rules. Like "If a door is open for 5 minutes send me a notification" I was able to do this in the other RMs easily, but in RM4 I have no idea how to set that. I see the triggers and actions and see the conditionals for actions (which is a bit confusing because I would think we would want conditionals on a trigger, but... that's just me)...

I read the documentation but I seem to be missing something... I cant seem to find a way to do something like that where it canceles the action if the door is closed in that 5 minute span. Also setting up something to keep repeating the notification every 5 - 10 minutes if it is left open. This now seems pretty convoluted, or some different logic flow than I was used to.

You'd need something like this:

Trigger:

Contact sensor *changed*

Actions:

IF ( Contact sensor closed ) THEN
    Cancel Delayed Actions
ELSE
    Log Sensor is open -> delayed 0:05:00 (cancelable)
END-IF
5 Likes

Also note that if this is all you want, the built-in Notifications app can do this with a lot less work. (It can't do the repeating notification example, so you'd still need something else like Rule Machine for that.)

3 Likes

We have a notification for our fridge door almost similar to what you're asking about, like this...

38

Thanks guys! This did help. For me having the logic in the actions and not in the trigger is what confused me a bit! This is definitely pretty geeked out logic/coding, I can see how people get intimidated by this platform a bit :slight_smile:

2 Likes

I've got a similar problem with RM and seem to be going around in circles.
I have contact sensors on the 2 pantry doors that I want to turn on a wifi bulb with a 3 minute timer to turn off the bulb if the doors are not closed but turn off the bulb if the 2 doors are closed before the 3 mins are up.
I can turn on & off the bulb when the doors are closed with the Simple Lighting Rule but RM has got me stumped.
Any help would be appreciated.

If I'm not misunderstanding anything here, I'd do something like this:

36

That's how I would do it too,

(EDIT: I missed the both doors part, disregard the part below

but I would just do ELSE instead of ELSE-IF. No need to burn the CPU cycles and value lookup time for a 2-state trigger.)

1 Like

The only thing is that the OP wants the light to go off if both doors are closed, hence the ELSE-IF.

Ah, good point. I should have read closer. You're right. :+1:

1 Like