Security Check for Door or Windows Open

I have been trying to get a Rule Machine to work like I want. I have not been successful. I would like to be notified at -the time- if any contact switches are open. I have been able to do it by having a Trigger Event at -the time- I want, and then the Actions to Run is an IF statement that if any contact switches are open, then notify me via Pushover and on a speaker using Notify Pushover and Speak on speaker: %device% is open. Unfortunately, %device% only works as a Trigger Event.
If I change it so the Trigger Event is any contact switch open, then the Actions to Run are: IF (Time is -the time- THEN Notify Pushover and Speak on speaker %device% is open. This results in only triggering when the time is and a contact switch is opened (not already open).
I tried using a Required Expression to be between -the time- and -the time- + 1 minute, but that fails to catch any already open.

First try:

Second try:

Suggestions?

Sorry I had to edit this a bunch because I used angle brackets and they were not liked.

There is a great app from @bertabcd1234 that will do most of what you are looking for:

Otherwise, the rule in Rule Machine that can identify opened sensors requires a lot more complexity… One of mine (I did this before finding the app above…) looks like this:


I have no trigger for those. I call them from other rules as needed and use the « openDoorMessageConnector » to share the name. A Hub variable would serve the same purpose. The « openDoorMessageCompleteConnector » allow the other rule to know when the rule has finished running (otherwise, it won’t work properly). I transition the string value from a local variable to a connector at the end because there was a bug that would cause the string not to form properly when the connector was updated multiple times. It might be fixed now, but this works, so I never changed it.

I have 3 of these rules setup. One for all doors, one for downstairs windows and one for upstairs windows.

1 Like

What I did for a similar outcome is used the list of relevant contact sensors - any being open as the predicate (required expression). Then I used a particular time as the trigger. For simplicity it simply notifies "something is open that should not be" and I can quickly see what by glancing at my dashboard. This is probably not very efficient on the hub though, since all day it's checking the devices! I guess I could have used time as a predicate too.

Actually, it does EVERYTHING I want it to do. Thanks @Sebastien and @bertabcd1234 !
Gotta love this community!

3 Likes

Yes, I had that already. I was looking for the announcement of the device still open. I try to stay away from dashboards if I can.