# Mode button triggers routines?

**URL:** <https://community.smartthings.com/t/mode-button-triggers-routines/73628>\
**Category:** Automation Ideas\
**Created:** [January 14, 2017, 12:22am UTC](https://community.smartthings.com/t/mode-button-triggers-routines/73628 "2017-01-14T00:22:28Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Etoimos](https://avatars.discourse-cdn.com/v4/letter/e/ac91a4/32.png) [@Etoimos](https://community.smartthings.com/u/Etoimos)\
**Post date:** [January 14, 2017, 12:22am UTC](https://community.smartthings.com/t/mode-button-triggers-routines/73628/1 "2017-01-14T00:22:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bago](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/bago/32/16144_2.png) [@bago](https://community.smartthings.com/u/bago)\
**Post date:** [January 14, 2017, 12:37am UTC](https://community.smartthings.com/t/mode-button-triggers-routines/73628/3 "2017-01-14T00:37:26Z")

</div>

> [@Navat604](#):
>
> no way to change the mode in the ST app

A routine can be used to change the mode.

---

<div class="post-metadata">

**Author:** ![bago](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/bago/32/16144_2.png) [@bago](https://community.smartthings.com/u/bago)\
**Post date:** [January 14, 2017, 12:42am UTC](https://community.smartthings.com/t/mode-button-triggers-routines/73628/5 "2017-01-14T00:42:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Navat604](https://avatars.discourse-cdn.com/v4/letter/n/898d66/32.png) [@Navat604](https://community.smartthings.com/u/Navat604)\
**Post date:** [January 14, 2017, 12:45am UTC](https://community.smartthings.com/t/mode-button-triggers-routines/73628/6 "2017-01-14T00:45:34Z")

</div>

Or just use CoRE SmartApp.

---

<div class="post-metadata">

**Author:** ![bago](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/bago/32/16144_2.png) [@bago](https://community.smartthings.com/u/bago)\
**Post date:** [January 14, 2017, 12:53am UTC](https://community.smartthings.com/t/mode-button-triggers-routines/73628/7 "2017-01-14T00:53:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JDRoberts](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/jdroberts/32/56577_2.png) [@JDRoberts](https://community.smartthings.com/u/JDRoberts)\
**Post date:** [January 14, 2017, 2:33am UTC](https://community.smartthings.com/t/mode-button-triggers-routines/73628/8 "2017-01-14T02:33:21Z")

</div>

> [@Etoimos](#):
>
> 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?

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.

 ![](https://global.discourse-cdn.com/smartthings/original/3X/2/6/26d779d123df7ed742d455007b248d57d23a063d.PNG)

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.”

> [@FAQ: Creating a virtual Groovy Device \[OBSOLETE\]](https://community.smartthings.com/t/faq-creating-a-virtual-device/11282):
>
> Need a FAQ for the simplest version of this: a virtual on/off switch. Maybe even two FAQs, one for why you would want one with use case examples and one step by step how to for creating one in ST. Thanks! 2023 Update Since groovy will be going away soon, so will groovy virtual switches. See the new FAQ for on the replacements: [FAQ: Creating Virtual Devices Without the IDE](https://community.smartthings.com/t/faq-creating-virtual-devices-without-the-ide/256073/)

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.

 ![](https://global.discourse-cdn.com/smartthings/original/3X/3/f/3f7851450ae81ebac52ace8063719cb379e048d6.JPG)

* * *

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. 🕶

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-](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.

> [@FAQ: What is WebCoRE? (And what was CoRE?)](https://community.smartthings.com/t/faq-what-is-core/59981):
>
> CoRE (now WebCore) is a very powerful community – created rules engine for SmartThings. It allows you to set up stacked conditionals like “If A then B but only while C and not if D.” Setting it up can be quite complex, but there are many community members who will be glad to help you. For example, here is a piston that one member created to notify him if the dog had already been fed twice that day and he picked up the dog bowl for a third time. He needed this because he has a large family and people didn’t always remember whose turn it was to feed the dog. dogblush [image] The original version of CoRE Has now been replaced by a new version, WebCoRE, which moves the data entry to a web interface. This allows for flexibility and an architecture that requires more memory than is av…

---

<div class="post-metadata">

**Author:** ![Navat604](https://avatars.discourse-cdn.com/v4/letter/n/898d66/32.png) [@Navat604](https://community.smartthings.com/u/Navat604)\
**Post date:** [January 14, 2017, 5:10am UTC](https://community.smartthings.com/t/mode-button-triggers-routines/73628/9 "2017-01-14T05:10:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Etoimos](https://avatars.discourse-cdn.com/v4/letter/e/ac91a4/32.png) [@Etoimos](https://community.smartthings.com/u/Etoimos)\
**Post date:** [January 14, 2017, 12:05pm UTC](https://community.smartthings.com/t/mode-button-triggers-routines/73628/10 "2017-01-14T12:05:38Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![JDRoberts](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/jdroberts/32/56577_2.png) [@JDRoberts](https://community.smartthings.com/u/JDRoberts)\
**Post date:** [January 14, 2017, 3:16pm UTC](https://community.smartthings.com/t/mode-button-triggers-routines/73628/11 "2017-01-14T15:16:44Z")

</div>

> [@Etoimos](#):
>
> 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.

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,

> [@FAQ: Armed/Disarmed states vs Away/Home modes confusion](https://community.smartthings.com/t/armed-disarmed-states-vs-away-home-modes-confusion/53367):
>
> Hello, I’m brand new to SmartThings, and I’m trying to configure Smart Home Monitor to alert not just on door open/close sensors and motion sensors, but also on certain vibration sensors when it is in the Armed state. I can’t find a way to do that. I can use Custom to make a vibration alert based on Away/Home/Night “modes”, but these appear to be totally separate from the Armed/Disarmed states. Am I missing something?

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

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:

> [@FAQ: What is WebCoRE? (And what was CoRE?)](https://community.smartthings.com/t/faq-what-is-core/59981):
>
> CoRE (now WebCore) is a very powerful community – created rules engine for SmartThings. It allows you to set up stacked conditionals like “If A then B but only while C and not if D.” Setting it up can be quite complex, but there are many community members who will be glad to help you. For example, here is a piston that one member created to notify him if the dog had already been fed twice that day and he picked up the dog bowl for a third time. He needed this because he has a large family and people didn’t always remember whose turn it was to feed the dog. dogblush [image] The original version of CoRE Has now been replaced by a new version, WebCoRE, which moves the data entry to a web interface. This allows for flexibility and an architecture that requires more memory than is av…

---

<div class="post-metadata">

**Author:** ![Etoimos](https://avatars.discourse-cdn.com/v4/letter/e/ac91a4/32.png) [@Etoimos](https://community.smartthings.com/u/Etoimos)\
**Post date:** [January 15, 2017, 12:15am UTC](https://community.smartthings.com/t/mode-button-triggers-routines/73628/12 "2017-01-15T00:15:12Z")

</div>

Nevermind.

---

<div class="post-metadata">

**Author:** ![Etoimos](https://avatars.discourse-cdn.com/v4/letter/e/ac91a4/32.png) [@Etoimos](https://community.smartthings.com/u/Etoimos)\
**Post date:** [January 15, 2017, 12:17am UTC](https://community.smartthings.com/t/mode-button-triggers-routines/73628/13 "2017-01-15T00:17:13Z")

</div>

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