Mode button triggers routines?

I"m trying to understand how changing the mode via the app would trigger routines. I’ve seen how I can have routines I’ve built change the mode, but how do you get changing the mode (via the app dashboard) to trigger, say the Good Bye routine?

A routine can be used to change the mode.

Just a routine or a virtual switch/button, etc.

Or just use CoRE SmartApp.

True. Or just use a routine (like we both do), so you can avoid CoRE and the dreaded rate limiting errors as of late.

You can do this by using a virtual switch.

There is a smartapp in the market place called “switch activates home phrase.” “Home phrase” is the original name for “routine.” People typically use this with IFTTT or Alexa, but you could use the same idea for this purpose.

One) create a virtual switch that will eventually run the routine that, say, you want to have run when the mode changes to “asleep.” Creating this switch is a one time step. For now we’ll call it “asleep mode switch.”

Two) use the “switch activates Home phrase” so that the asleep mode switch will start your good night routine.

Three) modify your good night routine so that it also turns off the asleep mode switch. That way it will be ready for the next time.

  1. now we have to have a way to turn on the asleep mode switch when the Mode changes to asleep. You can set this up with the official smart lighting feature.


Once you have this set up, anytime you change the mode to asleep, no matter how you changed it, the asleep mode switch will turn on. Then when it turns on, your good night routine will run and the asleep mode switch would be turned off again.

You can set up a number of different variations on this, but this will work. I’m sure you could also do it in core. :sunglasses:

The only advantage of putting the original mode change inside a routine rather than just doing it through core is that then you can use the official widget feature if you like rather than having to open the app each time. But of course if you were going to do that, you might as well just run the routine that you were having the virtual switch run.

https://support.smartthings.com/hc/en-us/articles/206145893-Is-there-a-SmartThings-widget-

So… I think it would probably be more straightforward to just do this with core, but you can also do it as I described above.

2 Likes

I am still curious on what type of task we would use mode to run routine.

Thanks for all replies and a special thanks to JD for yet another in depth answer. What prompted me to ask this question is that I currently don’t have a presence activated system and have just got our basic setup sorted out. I was looking for an easy way for the wife to be able to turn on the security system. Right now she would have to either dig though the routines and run the right one(s) or turn everything on manually. That’s no good.

Right on the ST app Dashboard, they give us an Armed (Away), Armed (Home) and Disarmed button. Pressing those buttons changes the Mode, but I can’t tell that they actually do anything behind the scenes. You would think that one could simply add the system being set to Armed Away as the trigger to do things… you know, like a normal security system.

I was not aware of the widget, to that might solve the problem of her having to dig though the routines to do things until we really automate this stuff. Now I need to look into ways to clean up the routines list…

Ah ha! That’s actually a different question than the one that you asked, because those aren’t “modes” in the SmartThings system. They are “armed states.” The following thread explains the differences,

So good for @Navat604 for continuing to ask that question, because now we can get you the right answer. :sunglasses:

The answer that I gave you above isn’t going to work, because that’s based on modes. there’s no smart lighting trigger for armed state change.

Right now, the only way to trigger based on the armed state changing is with custom code, including core. So to have a routine run when you change the SHM armed state on the dashboard, you’re really going to have to use core.

As you mentioned, it may be that just having a routine that itself changes the armed state ( along with whatever else you want done) and then setting up a widget for that routine will be the easiest for your wife to use. So you might want to look at that first, as it will be simpler to set up. You just create the routine that does everything you want, including changing the SHM armed state. So you might have a widget for a routine called “I’m home” and tapping that widget would disarm SHM and do whatever else you want the I’m home routine to do.

But if you do want to use The SHM armed state buttons on the SmartThings mobile app dashboard, you can do that with core, and there will be a lot of people to help you get it set up:

1 Like

Nevermind.

Never mind that last post… I think I found what I was missing.

1 Like