Anyone have a good routine for open/close sensors with 1 presence sensor home out of 5

We have 5 phones being used as presence sensors. We currently have “everyone leaves” and “someone arrives” routines setup. Works great. However, we have a young teenager that walks home from school and is 1 of the 5 presence sensors. They usually get home about 30m before we do. They are supposed to come home, start on homework, and not go outdoors until an adult has arrived at home. They usually stay in their room anyway as most teenagers do so they would never know if a door was opened from a burglar.

So we are trying to find a way to setup a routine so that if the teenager is home (phone present) and the open/door sensor is triggered for any reason that we all get an alert however it only needs to be when the teenager is the only presence sensor at home. If there are others we don’t want it to trigger because that means one of us is home with them.

I tried to set a routine where if 4 of the 5 sensors were gone (everyone leaves), the mode was home, and the open/close sensor triggered that we would get a notification. However that doesn’t work because we were all home today and everytime we opened the door we all got the notifications.

Is there any good way to set this routine we are trying for or is this just too complicated without an additional device?

Use the quick browse lists in the community – created wiki. There’s a list under smart apps for “presence.”

One of those is “M of N presence” and should do what you want.

If you haven’t used custom code in SmartThings before, it’s pretty straightforward: basically you copy the author’s code and paste it into your own account. Here is the FAQ for that process:

As @anon36505037 mentioned, you could also do this with core, which is very powerful, but it’s much more complex than the single purpose smartapps.

1 Like

Check out this app. It currently alerts if there is motion detected if the parents aren’t home. It could be enhanced to send a notification if a door is also opened.

Let us know your feedback on the features and we can enhance it to include additional features

This app is available to you along with all our other apps if you’ve subscribed to the RBoy apps on our website (

We should note that while most community members share their code freely, Rboy’s code is from a subscription website.

I don’t have any problem with developers charging for their work, but I think it’s important for the community that we let people know upfront if they are being told about a smartapp that will require a license fee.


You could probably do this by adding a new mode to your house (perhaps Teen Home). Then set up your app to provide the notification only when they house is in that mode (triggered by your teen arriving home). When you or your wife arrive home afterwards the house can then change to “Home” mode and the notifications would stop.


Am I blind lol? I’m looking at the github location for the “M of N presence” that pahrohfit has listed and I see the config file which only has 1 line and the readme but I don’t see what I’m supposed to be copying over to the ST dev site for the code. I know you said it was pretty much straightforward and just copy the code and paste it but am I looking in the wrong direction here? Sorry but I’m a novice when it comes to this.

It’s way down in there. To find it I had to:
Follow link to wiki that was provided
Click on presence things, click on m of n
Black page opens with description
Click on tiny “view on github” link
Select view code on next page
Select smartapps/profit on next page
Select which app you want on that page
Select groovy file
Then it should open with code, you’ll need the raw version.

I was trying to remember what I did to get there and using my phone so forgive any errors

1 Like

This might be easier if it works


I wouldn’t say regret, just say the light bulb came on AFTER I clicked reply.

1 Like

Lol thanks Don and no the essay was worth it. I now know how to get to it from the main link. Very much appreciated.