Door Left Open Reminder - Configurable by Individual Contact


#1

This piston, which is in two parts, provides an alert (and subsequent reminders) if doors, gates, or even windows have been left open beyond a defined amount of time. It is configurable by individual contact, meaning that both the amount of time each contact can remain open before a notification is sent, as well as how often a reminder is sent after the first notification, can be different for each contact. This is useful if, for example, you want to monitor the front door very closely, but don’t care if the garage or other door stays open for a much longer period.

The piston is designed to continue monitoring all of the defined contacts until all are closed. Thus if the front door is left open, and ten minutes later the side gate is left open (because the kids are just not paying attention today), you will receive separate notifications for each based on whatever times you have assigned them. If one of the doors is later closed, the notifications for that door will stop but the notifications for any others will continue according to your schedule.

I hope I’ve included adequate commentary in the pistons themselves for anyone who might be interested in something like this.

Edit: 03-10-2018: Revised timeOpenList[ ] variable from string to integer. This does not affect the piston function, but ensures consistency with the type of comparisons allowed by WebCoRE.

Edit: 11-19-2020: Minor revisions to simplify/declutter original piston and update push notifications for consistency with new ST App.


Continuous Door Open Reminder with Close Confirmation
Door Left Open Alert
Send notification on device contact open every time interval until contact closes
Notifications for open window or door
Notification limit
10-Day Weather Forecast Tiles
Sonos tells me "door left open"
Piston that only executes on call from another piston
My roommate keeps forgetting to closy the balcony door
#2

this is great work! thank you for sharing. I have to go make some mods to mine cause this is a lot more streamlined. :slight_smile:


#3

If you have the time, can you share this Piston as a .txt (cut and pace) please? I am blind and cannot see the .png file, and it is not readable by my screen reader. I have been struggling to create something like this for a while.

Thanks all over the place.


#4

@Roddj12 … the backup codes are 57zq and khwp. If you need the entire piston text pasted here, let me know and I’ll do that when I get back to my desktop pc.


#5

I just imported your pistons. They’re great. They’re working great. The only question I have is why in piston A (57zq) why is your minimum alert time set to five? Why not make it one minute?

Is there any downfall to setting it to “1”?

Only reason I ask is because if I open door “x” and door “x” stays open for five minutes then piston A executes piston B. Then the first notification I get from piston B says Door “x” was open for five minutes when it was actually open for 10 minutes. Follow me?

Thanks, eric


#6

Generally, the minimumAlertTime in both pistons A & B should be set to the lowest value in either doorAlertTimes or doorRepeatTimess in Piston B. The reason for this is simply to avoid unnecessary loops and checks and thereby reduce the processing load generated by the piston. There is no real harm to setting it lower, but doing so won’t provide any benefit.

Your example does have me a little confused. Assuming your alert time for ‘door x’ is five minutes, and your minimum alert time in both pistons is five minutes, as soon as piston B executes you will immediately get a notification that the door has been open for five minutes. It won’t (or at least shouldn’t, and doesn’t for me) wait until 10 minutes to give you the first alert. And changing the minimumAlertTime won’t affect that, because it doesn’t come into play until after piston B has executed it’s initial loop.

My initial thought is there is something odd or inconsistent in your configuration settings, so I would check those first. It’s equally possible that there is something in your settings that my programming didn’t anticipate, but it’s hard to be sure from here.


#7

@bthrock - thank you for the coes. I have imported the pistons. I now need to configure them accordingly.


#8

One additional comment I should add for others who might adapt this example for their own use: In the second piston, where the variable alertMessage is set, the piston does a lot of gymnastics to avoid sending a message with odd times. This works well for the settings in the example, which are all based on 5 minute increments, but might produce some less than ideal messages in certain circumstance. For example, if some or all the alerts and reminders are set to, say, three minutes, the reminders at 6 and 9 minutes would both say “The [door] has been open for more than five minutes.” If this bothers you, you can eliminate all the gymnastics and simplify the expression for the set variable alertMessage statement to:

"The " + doorNameList[$device] + " has been open for " + timeOpenList[$device] + " minutes."

#9

Here are screenshots of my Pistons that I modified from yours.

Any thoughts?


#10

In terms of your configuration, no. I imported and tested your pistons multiple times to check, and I received all notifications in accordance with the schedule you set.

However, the addition of the switch to turn the door check on or off adds a wrinkle, and I think the placement of your “if switch4 is on” before the notification may be problematic. That will turn off the notification, but not stop the piston from looping, which means the timers could still be running but no notifications would be sent. That could result in missed notifications and be misleading.

If what you want is the piston to stop checking the doors when the switch is turned off, I would place the switch state as an “or” under the “until” statement. So the “until” would be (all) doorsToCheck contacts is closed OR switch4 is off.

The only downside to doing it this way is that I think if the switch is turned off while doors or windows remain open, piston A will not reevaluate until any one of the contacts in doorsToCheck is opened or closed again.

Edit: Removed suggestion regarding adding a restriction to the ‘with’ statement. Doing so is harmless, but not really helpful. I didn’t think that one through at the time of posting.


#11

i see your point thanks. Have a good night.


#12


you can add SMS notification


#13

I really like seeing much better versions of the pistons I struggled to come up with. Thank you for allowing me to consolidate 3 pistons into 1! What is the benefit of having it send a “notification” and not a “PUSH notification?”

Edit: I’m having the same problem as @Eric182,. I have a couple doors that I want to alert me after 5 minutes, however, the first piston waits 5 minutes to execute the second piston then the second piston waits 5 minutes to send a message. From what I can tell, you’re telling the second piston to send the message once executed, but it seems to wait until the number of minutes defined in the repeat time before sending. Any ideas where I went wrong?


#14

Whats the difference between piston A and piston B?


#15

Piston A triggers Piston B. Piston A monitors your set of contact sensors for any of them to be open for a set amount of time (the lowest common duration) and triggers Piston B to run. Once piston B runs it determines if the contact sensor has been open for the appropriate amount of time, configures the message and then sends it. The second piston continues to repeat as long as the contact sensor remains open.


#16

Can you explain doorAlertTimes and doorRepeatTimes to me?

UPDATE SAW COMMENT FIELD ABOVE THAT, DISREGARD


#17

In case anyone is interested, here is how I reinvented the wheel:
I use two global variables. WaitTime gets decremented for increasingly frequent notifications and OpenTime gets summed to report the total time open. The IF statement simply prevents WaitTime from going negative and the result is that it eventually sends notification every minute. Since they’re global, I reset the variables at the end of the WHILE loop.


#18

If I wanted one set of contacts to be on a 10 min interval and some on a 30 minute interval, would I just create 4 pistons?

One set at 10 min, and one set at 30 minutes?


#19

The original piston at the top of this thread can be configured to manage up to 16 different contacts, each with their own custom interval.


#20

I figured out the way to set up the different contacts and set the times in piston #2. Any thoughts on how i could adapt this to an existing piston I am trying to replace? The premise is, I live in a very cold area in the winter and I want the timer to vary based on outside temps. I had a simple if/then based on the current outside temp to have a different notification timer if it was below 0F or if it was between 0 and 32 degrees.

I thought about making 2 sets of time. doorAlertTimesBelow0, doorAlertTimesAbove0 and doorRepeatTimesBelow0, doorAlertTimesAbove0.

If you notice, I am reading the {$weather.conditions.current_observation.temp_f} variable to make the decision.