Door Left Open Reminder - Configurable by Individual Contact


Does this work for lights left on? Locks left unlocked?

I am trying to use this piston with my Inovelli light switches and Schlage locks. Neither of them are returning any messages.

Everything works fine with my door contacts. Attached is a screenshot of my configuration.

Also on line 24, 25, and 26 I noticed some devices not listed in doorsToCheck (line 17). They are all devices I selected when testing out but no longer need them to be monitored.


Similar logic could be used for lights or locks, but the piston would have to be revised because, as currently written, it checks the status of the device’s contact instead of switch or lock, as you can see on lines 56, 58, and 91 of your snapshot. I’ve never really given this any thought as lights and locks are easy to turn off or lock remotely if they’ve been on or open too long, but I would probably create separate pistons to accomplish this to avoid complications.

Also, note that you have an error on lines 40 and 93, as the originating piston is not correctly specified. If the originating piston is not paused and resumed, the “B” piston may not always behave as expected.

With regard to lines 24-26, on the snapshot you provided those are fixed variables, so I don’t think those are the lines you intended to reference. My suspicion is that you meant to reference one of list variables below the line that says “Do Not Modify.” If so, then what you’re describing is normal. Clearing and/or stuffing list variables has been a hot topic around here for a while, but I don’t recall if the issue was ever fully addressed. In any case, while it’s annoying, it’s also harmless.


Everything was running fine up until 6 days ago when a notification started coming every 5 minutes for Contact Sensor 2 being open (should be every 300 minutes). Is there something wrong with the code?

Around this time the Smartthings app started getting the “Somethings Wrong” error 90% percent of the time. Are these related?


Without a log, it’s hard to diagnose anything, but the fact that the app was working fine and then, without any changes, started failing around the same time as the “Something’s Wrong” error began occurring, seems to suggest the problem may lie elsewhere. I’d take a closer look at the log for errors, as that may help narrow down the issue.


this is probably a dumb question but how does this work without subscribing to any events to trigger it? I’m getting that “no subscription” warning on this piston indicating it won’t fire


there are two pistons. The first piston triggers the second piston :slight_smile:


ahhh lol, that explains the tags where you have to target another piston, so within the first piston you target the second and at the bottom of the second piston you target the first I’m thinking, going to try this out thank you for the pointers! originally thought the second piston was an updated version of the first lol


do you have any idea how to modify the notifications? I want to change them to push notifications but they only show that they send an alert message to “{:xxxxxxxxxx…xx6}”


You can edit the text of the alert message on line 65 for variable alertmessage- that is the message you can send by push notification, sms if available in your region.

I noticed a couple of out-dated items that need correcting:

  • in the first piston, you will need to remove Smart Home Monitor is Disarmed. that feature no longer exist with new app that webcore can use.
  • in second piston, change send notification (alertmessage) to send push notification (alertmessage) and store in messages. click on the push notification command when editing the piston and change store messages to true.


what line is it on?

I am looking at the pistons in the first post of this thread


Is there any way to change the alert message to be a web request using the dame message information? I am using web requests via alexa to play audio notifications.


I expect that most people who have used this piston have modified the notifications to suit their preference. I myself have audio notification sent via web request to my Sonos speakers.

Generally speaking, for your purposes, you would use an expression to define the URL of the web request and incorporate the message variable into that expression.


Hello I was hoping to get some help. I successfully used your code on some freezer\fridge doors in my basement and it works great! No more defrosted meat! thank you!!!

I used your same basic code for my garage doors and modified it to shut them if left open… However I made a change to piston A that is not working 100% they way I want it to… I removed your “Smart Home Monitor status” check and added a Time check to work between Sunset and Sunrise…

It appears to work for every situation except 1… If the door is left open before Sunset and longer than the wait time, and then the time passes Sunset, the piston will not execute. This is the most important time for me as that is typically when the kids leave the door open the most…

Any thoughts on how to fix this?


Adding an inverted block to the very bottom should do the trick.

IF time happens daily at sunset + X min  <-- Trigger
and Door has been open for X min         <-- Condition
    Then execute piston

Note: This block should only have one lightning bolt next to the trigger.

The lazy way to code this is simply:

IF time happens daily at sunset + X min  <-- Trigger
    Then execute piston


So something like this?


It has to be entirely outside the original IF block.
(and don’t forget to add the proper offset… currently sunset + 5 min, or sunset + minimumAlertTime)

You can drag the block (at lines at 34-38) down to the bottom.


So this…


Looks decent… Is line 32 & 37 supposed to point towards different pistons?


That is my confusion…

The original Piston A code would do a check on the contact sensors and if found to be open longer than minimumAlertTime. This would execute Piston B which does a repeating check and sends out messages \ closes doors until the contact sensors are closed.

By me adding in the Timebetween sunset and sunrise condition, I think that it is creating a gap if the door is opened before sunset and stays open, it will evaluate the trigger and come up false. It does not check again once time passes sunset… Can use a piston to restart itself?

I do not think I want to have your code activate Piston B cause that bypasses the contacts check correct?

I was hoping that your code would force another check at sunset for this condition… Not sure if I am explaining this correctly


Correct. My advice was to point to the exact same piston at minimumAlertTime minutes past sunset

Pro Tip:

If your house is prone to lagging, you may want to use:
(minimumAlertTime + 1) minutes past sunset