I’m enjoying my time with ST… and having all of my connected lights turn off when I go to bed is great! What I would like to do, however, is tie in my Sleep as Android sleep tracking with the “Good Night” trigger, so as when I actually go to sleep, the rest of the lights will shut off, and the thermostat will be set to an appropriate night time temperature.
Ideally, it could also identify when ST is in Away mode, and not change to night mode in those cases when we may be staying out of town, etc.
Does anybody have some clear insight to how I could get these put together with Tasker, or SharpTools?
The way I recommend: They integrate with Tasker. There are threads/descriptions on how to integrate Tasker with ST (either IFTTT or Sharptools, can’t remember which, maybe even an easier way). I’d recommend this to start.
I believe that you could make another Android app that watched for the intents, and then directly talked to ST. This could be a challenge unless you are an App developer.
Tasker is set of automation tools for Android and you can use the intents from Sleep as Android to trigger events in Tasker. SharpTools is a set of SmartThings Tasker plugins I developed which allow you to control your Things, execute Phrases (Routines), and change Modes.
Use the notes below to setup the profile to react to your Sleep as Android events, then use the A Phrase plugin from Plugins > SharpTools to run your Routine.
React to Sleep as Android events in Tasker
Setup a Tasker profile using Event -> System -> Intent and add one of the Intents described below.
–Events– Sleep tracking started
Hey, thanks for the info! I just got done setting Tasker up to respond to SLEEP_TRACKING_STARTED and SLEEP_TRACKING_STOPPED, to try getting the current mode into the %st_mode variable, and only send “Good Night!” phrase if the current mode is Home, or send “Good Morning!” if the current mode is Night.
I’ll see if it works tonight, or if I have more tweaking to do yet
For more information on using conditional actions, see this article:
The other approach requires you to setup a separate profile to listen for the mode changes and then save that variable to a global variable, but results in the mode variable already being set so it reacts quicker.
Saving the Mode
Open the main SharpTools app, select Modes from the left navigation, long press on any mode and choose Subscribe to all mode changes
Create a new Tasker profile using Event > Plugin > SharpTools > Mode Change
In the Task, create an action using Variables > Variable Set Name: %STMODE To: %st_mode
Reacting to the Sleep as Android Event
Open your SLEEP_TRACKING_* event profile Note: You don’t need the Get Mode action here since the global %STMODE will already be set
Add both of your actions to run your desired phrases and make them conditional
Add the action using Plugin > SharpTools > A Phrase
Select your desired phrase from the list and hit apply (eg. Good Night!)
While you are still in the action, add an If conditional (eg. %STMODE ~ Home)
Heyyyyy, looks just like what I did this morning to fix it… First time that I’ve used the If function in Tasker, so I unknowingly changed the ‘~’ to equals… Didn’t know that equals was for numbers and ‘match’ was for string. Once I fixed that, it worked like a charm!