Door Left Open Reminder - Configurable by Individual Contact


Now I see where it is in your piston. The @AllPresence global variable is a device variable that contains a list of all the presence sensors you want to check.
Global variable appear in a panel on the right when you edit a piston. You’ll have to create a device global variable called @AllPresence (Click on the blue area in front of the name to change “dynamic” to “device”.), select Physical Devices, and then you’ll get that drop-down list that will contain all your devices. That’s where you’re looking for something that looks like MyName’s Galaxy Note10 (or whatever your phone is called), select that one and any others for other people in your home and then save the global variable.


@qoheleth is correct and this is what I suspected the problem might be. For simplicity when importing, I should probably post a more generic version of the piston that doesn’t include the use of the global variable.


OK thanks, I was able to get the @allpresence setup, But I am still different from the sample. Now my line 75 says "@allPresence’s presense is present, the sample shows Presense Sensor 1’s presense is present.

Also, how do I get (2) phone numbers to send a SMS for line 73? I typed (2) with an “and” beween them but only 1 shows up in the screen shot.


On line 69 and 71 you’ve used the variable ‘@allPresence’. On line 75, you’ve used the variable ‘@AllPresence’. Those two are NOT the same and will cause problems. Use one or the other, but not both, or … for the sake of simplicity and clarity, especially since you’re new to this, consider eliminating the @global variables altogether and replacing them with specific devices names instead. I wish I’d done that in the example.

To send an SMS to two numbers, specify an expression and use the format



Just a note here: Lines 67-73 result in sending the SMS notification every time they execute. (presence is either present or not present) So, encorporating bthrock’s post, you could replace everything from 68-80 with
Send SMS notification “{alertMessage}” to {9998881234};{9998881235};


For clarity, the way the piston was designed to work is that it sends to the alert to whichever one of us (my wife or I) is home, both to avoid disturbing the other and because the person at home can actually do something about the open door or window. If we’re both not home, then it goes to both of us. If we’re both home, then it goes to me.

For most people, a simpler notification like you suggest is going to be more than adequate. I may include something like that in an update as well, if only because it’s easier to explain and support. :thinking:


Yes. I had it set up to broadcast in my original arrive/leave piston, but I changed it at my wife’s request. I still get everything. She just gets a “Hello” and “Goodbye” message.


I would like to have it like you @bthrock and have it send the notification to me or my wife only if one of us is home and to both if we are both home or away. This is my latest attempt and it is still not working. If I select SMS as the delivery method for the alert is there something I needed to setup elsewhere first to get the message or is just listing the phone number in the piston all I need to do?


I can take a closer look at the details of the piston you posted a bit later, but could you also post a snapshot of the invoking piston (Door Left Open Reminder A)? Both pistons are needed for this to work and I want to be sure we’re focusing on the right issue.


Sure, here is my Reminder A.


I just received the door open message, it looks like this is working now.


I am getting the notifications, but not everything is working as planned. When both me and my wife were away we both received the notification which is what I want. But, when I was away and my wife was home I received the notification and she did not receive anything. This is the opposite of what I want to happen, I would like the person home to get the notification.


You have two presence sensors on Line 75. Assuming one is yours and one is your wife’s, that condition will always evaluate to be true and the SMS notification will go to the phone number provided in Line 77 every time. This is the how it should generally flow.

Line 74: Else If
Line 75: (Husband’s Presence Sensor) is Present
Line 76: then
Line 77: Send {alertMessage} to (Husband’s Phone Number)
Line 78: else
Line 79: Send {alertMessage} to (Wife’s Phone Number)


I hope someone can explain what I need to do to fix this. I only want to know the doors have been open for more than N minutes if the time is between sunset and sunrise. I have this code but it’s not working.

if {doorsToCheck}'s contact stays open for {minimumAlertTime} minutes
(Time is between 30 minutes past {$sunset} and {$nextMidnight}
Time is between {$midnight} and {$sunrise}

— call the main piston —

I am thinking of splitting this into 2 if expressions and then putting a wait of N minutes if the time is not in the boundary. I am hoping someone has a tried solution to getting this to work.

Thanks in advance


Simplify the time condition to a single line

The way ST and webCoRE works with $sunset and $sunrise, this will give you the result you need.


In addition to @bthrock’s suggestion, the line:
if {doorsToCheck}'s contact stays open for {minimumAlertTime} minutes
is a trigger… not a condition.

This means it only fires once at exactly X minutes after a door opens…

So, for example, if the door is opened at 4PM, and left open for a few hours, it will not fire when the sun goes down… The trigger (and time check) will happen at 4PM plus X minutes.


Thank you for that explanation. Now I need to figure out something that will allow me to loop, I think, or when a condition can be met.


Thanks. I will try that to see if it works however I think my problem is what WCmore stated; that the check is a trigger and will only fire once.


I would start with something like this:

IF Door's contact stays open for X min           <-- Trigger
    IF Time is not between $sunrise and $sunset  <-- Condition
        Then Do Stuff
    END IF

Every day at $sunset                             <-- Trigger
    IF Door's contact is open                    <-- Condition
        Then Do stuff
    END IF

(this last block will catch the doors that were opened before sunset)

Also note I inverted your times on line 3 so as not to span midnight.


My assumption was (and is?) that since you posted in the thread for the example piston and referenced “calling the main piston” that you were simply modifying the first piston (“A”) so that it would call the second piston (“B”) only when your time conditions were met. If so, then my solution will work. The second piston in the example (which is called by the first when the condition is met) already incorporates all the necessary looping mechanisms to track multiple doors as they open and close.

Unless I’ve misunderstood what you’re trying to accomplish (and it wouldn’t be the first time :smiley:) there’s no need to reinvent the wheel here.