Turn on/off devices when mode changes


(Chris W) #1

I’ve searched for a long time for an app that will turn devices (like space heaters) off when a mode changes (like from “someone home” to “everyone away”). This has to already be available, right? Am I missing something?


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

I think there’s an app called “Mode Magic”…?

But I also get the impression that Mode Changes are not actually a “triggering event” for most apps. Many apps look at the current mode before doing something, or change the mode, but do not “subscribe” to mode events; despite the Documentation giving “location state” as being an example execution trigger:

http://docs.smartthings.com/en/latest/smartapp-developers-guide/anatomy-and-life-cycle-of-a-smartapp.html#event-subscriptions

SmartApp Execution
SmartApps aren’t always running. Their various methods are executed when external events occur. SmartApps execute when any of the following types of events occur:
Pre-defined callback - Any of the predefined lifecycle events described above occur.
Device state change - An attribute changes on a device, which creates an event, which triggers a subscription, which calls a handler method within your SmartApp.
Location state change - A location attribute such as mode changes. Sunrise and sunset are other examples of location events
User action on the app - The user taps a SmartApp icon or shortcut in the mobile app UI
Scheduled event - Using a method like runIn(), you call a method within your SmartApp at a particular time .
Web services call Using our web services API, you create an endpoint accessible over the web that calls a method within your SmartApp.

Look at the screens in the mobile app for Add a New Hello Home Action (i.e., the first place that Users should be creating simple actions related to an overall condition like “everyone is away”…)…

The Automatically Perform screen (i.e., the triggers) include many choice, but not mode change.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #3

The Reference Documentation for SmartApps, confirms that subscription to mode changes is permitted; so if the apps written for Hello Home don’t use it, well, that’s their own choice.

Though the specific example you used (“Everyone Leaves”) is exactly in a Hello Home Action App, per my previous post.

As for the mode subscription:
https://graph.api.smartthings.com/ide/doc/smartApp

The Community here will quickly chime in with their favorite mode-based apps. if that’s still the best way to handle your requirement… :smile:


(NotoiousBDG) #4

As @tgauchat mentions, you can accomplish what you desire natively without needing to subscribe to mode changes. There are 2 builtin ways to do what you want. The first way is to create a hello home phrase to turn off the space heater and configure it to automatically run when “everyone leaves”. The second option is to setup the space heater setup under Lights & Switches, then configuring the option called “turn off when people depart”. If you wish to perform more than just turning off the space heater when you leave, hello home actions would be better, but if all you want is to control your space heater, then lights & switches is easier to setup.


(Chris W) #5

Maybe I’m confused as to what triggering when people depart means but to me that sound like if I have two people in the house and both selected as part of a new hello home action, wouldn’t that action trigger if either person leaves? It’s not clear from the UI. If that’s tge case, it’s not what I want. I want the heaters turned off when the last person leaves and there’s no one left.


(Chris W) #6

Ahh. Hello Home works. Thanks.