Alert when door sensor is tripped, then wait 2 minutes before alerting again


I was suggesting a hard coded solution for a set number of notifications.

The following basic structure may look primitive, but I find it to be more customizable, with zero chance of an infinite loop.

IF Door’s contact stays open for 121 sec  <-- Trigger
    Send first notification  (friendly reminder)
    Wait 2 minutes
    IF Door’s contact is open             <-- Condition
        Send second notification  (slightly aggressive)
        Wait 2 minutes
    END IF
    IF Door’s contact is open             <-- Condition
        Send third notification  (stress the urgency)
        Flash (centrally located light) briefly
        Wait 5 minutes   (notice I changed this)
    END IF
    IF Door’s contact is open             <-- Condition
        Send fourth notification  (Get off your butt!)
        Flash one light in each of the main rooms
        Voice Alert (Alexa/Google/Sonos etc)
        Wait 5 minutes
    END IF
    IF Door’s contact is open             <-- Condition
        Send fifth & last notification  (slowly drags index finger across throat)
        Turn on one light in every room
        Send Urgent SMS to home owners
    END IF

Pro Tip:

The last block can also send a SMS to a trustworthy neighbor… In case the logic gets that far down in the code without the door closing. (although I would not add that code during testing, LOL)


This seems to work!

I only did 4 cycles and I’ll have to work on the Alexa integration, haven’t ventured that far yet.
Nor did I see a way to add my ST plug in outlet as an action. I see LIFX listed. Would I need to call another Piston?




Lookin’ good!!

I must have missed that part of the conversation… What is your plans with that device?
(It’ll probably go in one of the pistons we just made)


You mentioned flashing lights. I have a Smartthings plug-in outlet that my office lamp is on. Didn’t see how to add a line to flash it.

I have the Alexa Smartapp added, just haven’t looked for any examples yet.


Ahh ok… If you don’t have any smart bulbs, then the best flash might be simply:

Turn on
Wait 2 secs
Turn off

Here is how I get Alexa to give me voice alerts.
(takes 20-30 min to setup, but only 2 seconds for all future voice alerts)

The good news is, with the above structure, you can add more commands to it as your house gets smarter.


I still don’t see where to add reference to the light. If I click on new task say below “Send PUSH notification” the only thing close is execute piston. I don’t see the option to interact with a device directly at that level?


Inside the appropriate block, click on:

+ add a new statement > Add an action > then choose your outlet > add a task > select a command

The rest should be familiar…


got it, I was looking at the + add a new task above it, thinking the + add a new statement was outside of the current action…I think keeping the nesting straight is my biggest challenge.



I think I understand what happened. If you closed the door and reopened it before the 2 minute timer was up, it likely interrupted the piston and the Boolean never got set back to false, would need to add protection for that case. I would suggest adding another trigger like this to the end of the piston:

If contact sensor changes to closed
    Set door_opened=false
    Cancel all pending tasks
End if


The door open/close pistons have been working, however as of a few days ago my push alerts have been delayed. I’m talking over a minute later I receive the alert.

I’ve tried rebooting the hub and it’s still randomly delayed.

Is this a Smartthings issue or something to do with Webcore or both?

Does Webcore run locally on Smarthings or does it still have to go to the cloud to run?

I’ve recently been looking into Home Assistant and I’m seriously considering moving to it so everything runs locally. Anyone have any experience with it?



This is not normal. Can you share the piston that is sending delayed PUSH notifications?

Side Note:

If all of your pistons are sending delayed PUSH notifications, then rebooting your cell phone can make a big difference. (since that is the device that receives the PUSH)