Door Open Rule

So I'm sure this is simple but It's not working the way I have it. (I'm better with the simple automation apps) I'm trying to create a rule in which when either my back or front door contact sensors are open for more than 2 minutes it starts to notify us (google speaker and pushover) and repeats every 2 mins until the door is closed or till a button is pushed (the button push is helpful if we want to leave the door open and the rule resets once the door closes.... Any help is appreciated. Here is what I have now.

I think you could use the same trigger but add a Wait 2min as the first action then do an IF statement to check if the door sensor is still open.

I would change the trigger to sensor "changed". As it is it will only run if the contact sensor is open so it will never evaluate when it is closed. Your if statement also checks if it is open, you will need to check if it is closed. Also, it will send the closed message if either one is closed or both.

You could simplify this by just using the notification app instead of rule machine. It won’t let you cancel it with a button but it works well.

Try something like this. Create the virtual mute switch device, then set your pico button to turn-on the virtual mute switch.

I had it set up that way but I need the cancel button so we can leave he door open when needed

Now does the end-rep essentially help reset the rule when the door is physically closed or do I have to manually rearm the virtual mute switch?

Yeah I didn’t test enough. This one tested good.

Change your delays accordingly :slight_smile:

1 Like

Thanks a lot, I'll give that a whirl and let you know...

On way that should work is to create a virtual contact sensor. If the pertinent door contacts are all closed, then the virtual contact sensor is closed. Once the virtual contact is opened, wait for your specified delay time and then trigger the notification to close the door. You can set a repeat so the notification will be triggered again until the doors are closed.

If all doors are closed within that delay period, then the virtual contact will close and the notification will not be triggered. If you wish, you could then trigger another notification to thank them for closing the door in a timely manner.

This method will easily work within Basic Rules if you want to avoid the complexity of Rule Machine.

So I made some alterations based on behavior (since mute switch was being force off it was immediately triggering the next action) I think the rule works except it's seeing that if any of the doors are closed regardless of one being open it triggers the door closed portion of the rule. Tell me what you think...

When I created the condition for contacts closed, had to enable the option for “All of these”

Gotcha... I have to make one other alteration and I'll repost... Thanks so much for the help...

At this point the rule mostly works. The only 2 issue I have are delays and cancelation. If one of the cancel actions happens, the delay timer has to run out before the message is issued. So weather the door closes or the virtual button is pushed the timer has to run down before the message is sent. Also if you open then close the door (which happens obviously during the countdown) the rule continues to the door is left open portion of the rule then goes to the door is closed part of the rule. It should automatically cancel the rule once the closed action happens so I'm not sure what I'm missing (for that matter, pressing the mute switch should automatically stop the countdown timer and go to the alerts cancelled section. (again appreciate the help. I figure if I can discern the logic of this rule I'll have the rest down pat) Here's new screen shot of rule.

Try this mod. Had to store the %device% label in a local variable… the timeout of the conditional wait seems to reset %device%.
If the door closes within the timeout period the rules advance and you get a notification about the close. Maybe not ideal. Could add some time stamp to a local variable when the door opens, then check again when the door is shut and if it happens within n seconds stop the repeat and exit rules.


If we use the wait-for-event timeout behavior then we can build a path to silently exit the loop ahead of the repeat block for handling a short open/close sequence. In so doing I had to create another local variable… couldn’t figure out how to build a new condition that compares a variable against %device% without first storing %device% in another variable…
This latest mod remains silent until the wait-for-event timeout period expires without the door having closed. Then you’re in the repeat loop where wait-for-conditions section handles door close or mute switch enable events in real-time instead of having to wait for the repeat period.
Think I’ll use this for my own door alerts too. Cheers!

I'll give it a go in the morning (it's at the new house) This seems like I threw you a puzzle and you're determined to solve it :joy: Which local variables do I have to create?

1 Like

Thank you again

I think you should use miscreants instead of cretins. I just like miscreants better.

Download the Hubitat app