Open/Close Door Notifications

Hi All,
I was following one of the threads on here on how to setup a Slack notification in Rule Machine if one of my doors is left open for more than 25 minutes and to have it send a followup notification once the door is closed. If the door gets closed before the 25 minutes it shouldn't send anything.

Previously I just used the Notifications app, and it worked great to notify me if the door had been left open for 25 minutes, but it didn't support telling me once the door has been closed. I'm using the following rule in Rule Machine, but it's triggering and sending me slack alerts at the same time/together of "Door has been open for 25 minutes" + "Door has been closed".

Please see my current rule I'm using:

Here is how the alert shows up most of the time in Slack (I have had some instances where it did send the "Door is closed" a few minutes later, but most of the time I receive this double alert.)
Screenshot from 2024-05-28 20-53-02

I took a look at the logs for the door contact sensor and it looks like the alert is falsely triggering as the door is open/closed within a couple seconds at 4:25 and had been closed for hours before. Additionally after it was open/closed at 4:25 25 minutes later the door was briefly opened again so I got a single "Door has been open for 25 minutes" at 4:50 even though the door had been closed for the 25 minutes prior. Perhaps a current rule that was in the "wait" period just happened to see the sensor open 25 minutes later?). And then at 5:06 another double "door is open 25 minutes" immediately followed by "door is now closed" alert came through on Slack. How can i update the rule to prevent that?

I'd suggest using a so-called sticky trigger by enabling the "and stays?" option for 25 minutes instead of doing things the way you are now, which should also mean you can get rid of your first two actions.

You may run into problems regardless if your device sends duplicate events in quick succession (typically a fraction of a second apart, though there's no hard rule), but I'm not sure I see any of that in your screenshot.

Enabling all logging for the rule and looking at that output is likely to be easier for future troubleshooting than devcie logs alone, if it comes to that.

4 Likes

Thank you! I have updated the rule to look like as follows, does this look correct based on your recommendation or do I still need to add a "timeout" to that first action? Using the stays option will it auto-cancel the rest of the rule from running if the door is closed within that time period? Testing this remotely or else I would test that out.

1 Like

I think what @bertabcd1234 was saying was to add the "and stays..." to your trigger. That will take out the first wait in your actions completely. After that it's just a straightforward Notify, Wait, Notify.

3 Likes

Thanks for the clarification! I didn't realize I could set the "and stays" on the trigger event. Think I got it now. Thanks y'all!

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.