Door Left Open Reminder - Configurable by Individual Contact


So at this test, my first notification was 14 minutes, and my second notification was 29 minutes. Soooooo, the times actually were right, but the distance between them, and why they came at those times is a mystery. Your recommending I import your last piston?

Ill do that then now…

So if I am understanding correctly. If I have the window dooralerttime set to 10 and the doorrepeattime set to 10…the msgs should come like this…Kitchen window opened for 10 minutes, Kitchen window opened for 20 minutes…etc.etc.

The same idea would be, if I had the window dooralerttime set to 10 and the doorrepeattime set to 15…the messages should come…Kitchen window has been opened for 10 minutes, kitchen window has been opened for 25 minutes, kitchen window has been opened for 40 minutes…

IS that correct?


So I think I got things are working pretty good now. When I set the minalertime to 1, I got a better understanding of what is going on.

So my kitchen window test, ran correctly at 10 minutes and then 21 minutes…Which was appropriate. I only been working with one contact sensor up to this point. Tomorrow I am going to add a bunch more, so I hope things still work.

I do have one last question perhaps you can answer.

If the kitchen window is open, and remains open. Then the front door opens…Will Piston B pick up and report the front door? If the report time is less than the kitchen window?


The notification times will vary slightly for a variety of reasons. A minute or two off is not uncommon. That was why I originally rounded the times. It annoyed me for absolutely no good reason. :rofl:



@bthrock I’m happy to report, that this morning, after it was such a warm day, and we had multiple doors/windows open, everything functioned as such.

After seeing the piston in motion though, I was thinking of a couple different variations I wanted to try.

The first thing is I would like to make the notification Speak, but only the first time…And then subsequently after that only make it go to sms. I was going to attempt something like this starting at line 65.
Do you think something like this syntax would work?

iF {timeOpenList[$device]} < {doorAlertTimes[$device]}
Speak to Echo.
Send SMS

I am trying to add it, but I cannot figure out how to add in a IF at line 65. I see you have one, for your If’s with presence sensors, but cant seem to track down how to get it in there.


Glad to hear it’s working for you.

You can an ‘if’ anywhere anywhere the words ‘+ add a new statement’ appear in the editing window.

I be misreading your intent, but my first impression is that your ‘IF’ statement isn’t going to work quite the way you want. Unfortunately I’m on the run this morning and will have to take a closer look at a bit later to be sure.


I got it going…Looking forward to growing this thing


I’m looking to add a notification once the door has been closed but at the moment, it’s waiting for the timer to expire to check if the door is closed/open and {doorNameList[$device]} doesn’t seem to work at the point of sending the closed notification. Is there any way to notify as soon as the contact is closed and get that variable to display the correct sensor?
I’m new … please be gentle :slight_smile:

EDIT: it looks like the way this is set, with the minimalAlertTime from the A piston, if my sensor on a 30 minute delay is open for more than that variable, i won’t necessarily get an open notification but i’ll still get one for closed. there’s a lot to digest here. i need to wrap my head around the logic.

EDIT 2: I fixed the device variable for the closed notification and set the minimums to 1 minute. That should mostly take care of my first concerns, however, the first edit still stands.


Hello, I’ve looked these pistons over and over again and can’t see why it’s not sending me the message when the doors are left open. Any thing stand out to you guys? Sorry if this seems simple, but I really don’t have any background in coding. Thanks!!


My initial thought is that adding a ‘door closed’ notification within the body of the original piston is going to be challenging, but since it’s been a bit since your original post can you update me on your progress?. Sorry I haven’t had time to look at this sooner.


There’s a lot to digest with all the changes you’ve made to the original piston as well as some structural issues (like the use of else-if statements) that complicate things a bit. I’ll give it a closer look as time allows.


I toyed with it a bit but got stuck. Since I’m new, I figured I would work my way up to something like this. And since it’s so easy to open the app and check the status of the door, a notification isn’t a major necessity. I’m using it the way you wrote it and it’s working like a champ. Thank you, again, for sharing – really excellent and well thought through code!


For reference, I took the basis of my code from the code kxavier_23 had posted above. I appreciate any ideas you may have! Thanks in advance!