Notifications for open window or door


Looking for a piston that will send me a text when a window or door opens & Smart Things is in away mode. Looked in the examples & do not see any. Have no problem importing someone eases & just changing devices & notification number.
Thanks Mike


I don’t think you need webcore for that. You can do that with the Smartthings App.



Thanks I will try the smart app & see how it works.


If you like to keep everything in webcore (I do) the piston you want is very simple.
I just wrote it for one sensor. You can add as many as you want\ also you can play alarm through you speakers, flash lights etc.
You just need to add statements within this IF.
Try this:


Thanks Ike that is what I was looking for I like webcore better then smart apps.
Thanks Mike


I can’t remember if the smart home monitor runs locally or not. If it does you might want to configure the alarm to arm when you go into away mode and disarm when it leaves away mode. Then you can have SHM monitor any contact sensor you want and you’ll get a notification if one is opened.

If you want to stay in Webcore, you can use @ike2018’s piston. And to make it look a little nicer (and not have 10 pistons for 10 contact sensors) you can create a variable with any number of devices, then in the message part, change it to expression and write a statement with the variable name. This will tell you the offending contact sensor. Like so…

Edit: oops, I missed an important step. You have to define the contacts that are open and use that store in your expression, otherwise it’ll just list all the devices you’re monitoring. Sorry, I can walk you through it if you need.


Yes @dmo012 @siam looks great. I am actually using something very similar to @Dmo012. Neat piston.


What would this code per say look like if it added a time of open?

Such as ‘contact1 has been open x amount of minutes, send sms’?

I’m staring at that trying to figure out how to work it in. My simple mind cannot. Learning fast though :).


That’s pretty much what you need. For example:

IF Contact Sensor X’s contact stays open for X minutes
THEN Send SMS notification “Something has been open for X minutes” to …

You can get fancier and set the name of the open device to a variable and then put the variable’s value in the text message to identify which sensor is open if you have more than one.


How? Newbie here. i want to be notified at 10:00 PM that a window remains open. Thanks!



Hi Dmo012,

I copied your code and I don’t know how to do the step you mentioned on defining the contacts that are open. Can you elaborate.



Hi @amignaci, sorry it’s been a while so I had to re-learn.

You’ll want to create a new variable first then when creating the IF statement click the setting wheel. It’ll bring up some other options and the top one is to store matching devices in a variable. This will shocker save any matching device to that variable every time that IF statement evaluated.

I hope this is what you meant, let me know if you need more help!


Thanks for responding! So here’s what I did, I copied your code using the 5 character code in your post. Assigned my contact sensors and added my phone number. Then I tested it, it worked. However, the text message sent to my phone listed all the sensors that I assigned and not the sensor that I left open. I believe that I am missing something.


post the latests piston


Here’s a super old piston I’ve been running for ages:

I use it for a gate but you could do this for windows just the same.

While the gate is open, it sends a nagging message every 10 minutes, stating the duration the gate has been open:

WARNING - The back gate has been open for 10 minutes
WARNING - The back gate has been open for 20 minutes

WARNING - The back gate has been open for 1 hour and 10 minutes

etc. etc.


That is all that piston can do, you would need to change the text message to reference {$currentEventDevice} if you wan’t it to state the specific device that triggered the piston.


If you use Dmo012’s idea, you’ll have a variable that contains all the devices from your list of checked devices that currently show open which you could use instead of the one that’s showing you all the devices you check, open or not.


Hi all, I went ahead and edited the piston I posted above to include the matching store.

Try this one on for size.