Running an app from a phrase


(www.rboyapps.com - Make your home your butler!) #1

I have a thermostat program set to run during the Home and Night modes. When we leave the house SmartThings does a Goodbye which set it to away mode so the thermostat program won’t run.

When we come back it does a I’m back and sets the mode to Home. The problem is yesterday we came back late and the last thermostat program was set to run at 8pm but the I’m back phrase ran at 9pm so the thermostat temperature didn’t change.

Is there some way to have an app update function be called when a phrase is run? If not can anyone suggest how this situation be handled? The ST platform will not execute any timers for the app when in away mode so how does one do this?


(www.rboyapps.com - Make your home your butler!) #2

Am going to answer my own question with one workaround, subscribe to mode changes. This function is called when a supported mode is set.

But having said that is there some way to detect phrases being run?


(Bruce) #3

One way is to use an app with a Momentary Tile Button device to which it subscribes to “switch.on”. You can create the device in the IDE. Just turn on the device in the phrase, and the app will run. Since it’s a momentary device, it will “turn off” again so you don’t have to take care of that.


(www.rboyapps.com - Make your home your butler!) #4

Interesting approach. I’ve guessing this device code is readily available in the sample codes.


(Bruce) #5

The device is one of the ones available in the IDE. Go to My Devices, click on New Device, give a name and address, and pick “Momentary Button Tile” for type from the pull-down menu. Assign it to your hub, then click Create. It will show up in the mobile app, move it out of the way. That’s all there is to it. It will link a phrase to your app, which presumably has more context than just being called from a phrase. You would be adding a Section to Preferences to select the Momentary Button Tile device, and the subscribe code, and the method you want to run.