[DEPRECATED] 2015 Voice Assistant Run Routine FAQ--see 2017 FAQ instead


#1

On October 1, 2016, Amazon added the ability to turn on a " routine" from Alexa. If you want to use that method, see the official support article.

Note that the official method will not allow you to use echo to run any routine that includes a lock or a Smart Home Monitor armed state change or another device class that Alexa does not know. The method described below in this FAQ will, but it does require that you create a virtual switch.

Although at present echo can only request that smartthings turn devices on, off or dim, by using a virtual switch, you can tell echo to turn that switch on or off, and then have all kinds of things happen in smartthings. For example, if you want to have echo turn on Party Mode, you would create a virtual switch in smartthings, authorize echo to use it, and then on the SmartThings side set up a smart app that will change the mode to Party whenever that switch is flipped.

From then on whenever you tell echo “Alexa, turn on Party mode,” SmartThings will switch to Party mode.

A virtual switch is defined in the IDE using a device type, typically a “simulated switch” or a “momentary button tile.” Once you have defined it, the switch is treated like any physical switch that is connected to the smartthings network. It will have a tile on the things screen in the smartthings mobile app and you can toggle it there. You can also access it from other systems that are integrated with smartthings, like echo, harmony, or IFTTT. Just like it was a physical switch.

So the basic steps are:

1) create a virtual switch in SmartThings.

FAQ on creating a virtual switch:

2) set up smartthings to do something when that virtual switch is turned on.

I used to recommend the “Alexa helper” smart app for this, but it has become extremely complicated over time, and I find it I just get a lot of people coming back and saying they can’t figure out how to use that.

So you can go ahead and use the Alexa helper app if you want to. But if you want a simpler version, just use the “switch activates home phrase” Smart app which is available in the official SmartThings mobile app in the marketplace section under lights and switches. ( “Home phrase” is the old name for “routine,” but means the same thing.)

The main difference between this one and Alexa helper is that with this one you have to remember to turn the switch off again before you’ll be able to use it a second time. But it’s definitely easier to understand and set up.


If you want the switch to turn itself off again automatically you can add an additional smart lighting automation and use the power allowance feature to turn The virtual binary switch off again after one minute. That way it will be ready again the next time you want to use it.

If you do want something more powerful with many more options, take a look at “Alexa helper.”

It will work with both momentary or binary switches, and can trigger either a mode change or a Routine.

3) AUTHORIZE AN INTEGRATED SERVICE, LIKE ECHO, TO ACCESS THE VIRTUAL SWITCH

For echo, you just have to have associated Echo with SmartThings, then discover the authorized device. Here is the FAQ on setting up echo and smartthings if you haven’t already done that:

If you already have echo set up but now you are adding a new device that you want to go to control , see step 10 in the first post of the thread.

The process for harmony, or IFTTT, is similar. The main point is that once you have created the virtual switch over on the smartthings side, it looks just like any other device connected to your network. So you authorize it for use by integrated services in the same way as any other device.

4) use an echo group to fine-tune the voice command you will use.

Sometimes I like to use a different name for the device in the SmartThings network then I will use to say to echo. For example, maybe I call the virtual switch “party mode virtual switch” in the smartthings device list. But I don’t want to say all that to echo each time.

So in the echo app I would create a group called “party mode” and I would put the one device, “party mode virtual switch” into that group. From then on, I could just say “turn party mode on” and echo would tell smartthings to turn on that virtual switch.

So that’s how you get Echo to change the mode in SmartThings. You create a virtual switch in SmartThings, set up SmartThings to change the mode when that virtual switch goes on, and give Echo permission to access that virtual switch. :sunglasses:


Using "Hello Home" Phrases with Amazon Echo?
SmartThings + Amazon Echo Official Integration
Alexa open my garage
Hacking Routines to run with a virtual devices
Alexa not recognizing Shlage locks (or garage door)
Does Anyone Still Use SmartThings?
Lighting/Dimmer Automation?
Virtual Device Ideas Thread
Light Switches - where to start? (UK)
Flic button
IFTT Integration Questions
Amazon Echo keeps re-learning the routines I told it to forget
SmartThings + Kwikset Locks + Alexa = No control
Amazon echo and Scout
Does Google Home work with Smarthings and community created apps?
Concept of Native compatibility versus compatibility through Smartthings through Amazon Alexa
Using Virtual Switch to trigger Routine?
Amazon Echo - Current summary of what/how it integrates with ST? (May 2016)
Alexa and routines from smartthings won't trigger
FAQ: Creating a virtual Device
Confusion - Modes vs Routines with Devices
Confusion - Modes vs Routines with Devices
Automatically go into night mode
Noticed routines are now being added to Alexa, what is the keyword to trigger those routines
Noticed routines are now being added to Alexa, what is the keyword to trigger those routines
Having trouble with one option in Automation (Google Home and routines?)
Alexa Trigger Phrase and Alexa Routines (new Alexa feature)
Virtual Switch .... Mode change; Frustrating
Creative ways to set night mode on alarm?
[WITHDRAWN] Yamaha RX-V Network Receivers
[RELEASE] Alexa Helper
Amazon Echo with Smart Things: controlling locks?
Google Home my first impressing with using
Google Home door locks?
Smart Home Monitor LIVE!
Program a button on the Logitech Harmony remote to trigger a routine?
More bugs.. more problems
Set mode via location?
FAQ: Creating a virtual Device
Trouble discovering Kwikset Z-wave Lock on Amazon Echo
Virtual Device Help and Echo
SmartThings + Amazon Echo Official Integration
Hints on setting up Echo with ST, Hue and GE Links
Have smartthings and harmony turn on the stereo when I leave?
Have smartthings and harmony turn on the stereo when I leave?
How do you use Echo with SmartThings?
Smartthings and echo
Smartthings Rules, Triggers, Conditions
Using Google Home to verbally trigger a routine?
(Richard) #2

In these cases, we’d want to use a simulated switch, correct? I have it setup that way, and then have the switch turned off during another mode change, effectively resetting it. If I use a momentary tile, it would trigger one mode change after another as it goes on and off, correct?


#3

Just depends how you set it up.

The momentary switch goes on and off. Just one cycle on and off.

So if you use only the “on” to trigger the mode change and ignore the “off” then that’s all that will happen. Every time you say “Alexa, turn on party mode” Alexa will be able to turn on the switch because it’s always off except for that one moment, and your mode change will happen.

If you preferred to use a binary switch, like the “simulated switch” device type, you certainly can, but then you have to have something that turns it off again before you want to use it next time.


(Richard) #4

Except the “switch activates home phrase” requires the on and off to be chosen. So what you’re saying it just create a null home action and assign the off to it?


#5

Sure, that would work except I would probably do it the other way around.

I would have The first virtual switch turning on do nothing but turn on a second virtual momentary switch. And then I would have the first virtual switch turning off trigger the hello home action I wanted. But that’s just because I prefer a positive action at the end of an event string.

But I’m not 100% sure how those two apps are intended to work, let’s see what the author has to say.

@MichaelS can we use your two big switch variants with momentary switches? The one that does a hello home Action and the one that does just a mode change?

How would you recommend they be set up if you were trying to do a virtual switch for Amazon echo to control?


(Micheal ) #6

Looking at the code, any event (on or off) that is tripped on the specific virtual switch is evaluated for either being ‘on’ or ‘off’. So, if you have an ‘on’ action and no off action, the momentary switch should work. I was unaware of the momentary virtual switch when I created this app, so I will appreciate any feedback on whether it works or not and in what circumstances. I can certainly create variations and submit them for publication if necessary. However, if possible, I would wait a bit…

I have my Echo on order and will see what apps I need to get it to work with my home automation. I will publish them out to everyone as specific Echo or Alexa apps as I create them. If there is a specific need someone has for this device, please let me know, but as JD mentions, most of the ‘fun stuff’ will need to happen with virtual switches in place until the Echo get more functionality into modes and phrases.

Hope that helps.


(Ricardo Souza) #7

I did everything that you guys suggested above and tested it manually.
What I am trying to do is have Echo Unlock and Lock the Scalage Deadbolt on my front door (I’ve already considered the security implications - my echo is in a place where no one can shout to it from the outside and we are an English speaking family in a Portuguese speaking country, which helps!).
Created the virtual switch, successfully set it up to change home phrases that unlock and lock the door.
However, Echo refuses to discover my Virtual Switch. Any clues?


#8

You have to authorize each new device in SmartThings for use by echo before echo will be able to discover it.

Did you read the echo set up FAQ? If you’re adding new devices after you already have some setup see step 10 A)


(Ron S) #9

Buddy, after installing the app, I am assuming that both on and off triggering something is “required”. It would be nice to have the turn off option as optional. It is possible that I missed something. Nice app and works as expected for me.


#10

Agreed, especially since momentary switches are typically only subscribed to for an “on” state.


(Micheal ) #11

In the phrase change, the on and off are required (not sure why I did that), but in the mode change they weren’t. Either way, both of those apps have been superseded by the app below, which combines the mode and phrase change in one app and does not require them all to be used. See if this works better for you…I have submitted for publication and it was approved, but not yet listed in the app…Enjoy!

I did get my Echo this week and am setting it up tomorrow…I am sure there are some apps from me forthcoming to get it to do what I want it to.

https://github.com/MichaelStruck/SmartThings/blob/master/IFTTT-SmartApps/Switch-Changes-Phase-or-Mode/Switch%20Changes%20Phase%20or%20Mode.groovy


(Ron S) #12

You are the man! 20 chars!


#13

Totally Awesomesauce! LOL :sunglasses:


(Ricardo Souza) #14

Thank you for the help and especially, the extremely quick response!!

You and some the other fellows are actually carrying this thing on your backs with such AWESOME help that you provide!!

THANK YOU!!!


(Ron S) #15

@MichaelS @JDRoberts

I was a super idiot last night and wondering why Alexa wouldn’t turn on Night Mode. I forgot the fact that behind the scene, there is a virtual switch which needs to be turned off. Darn! So, basically have a hello home now which resets it every morning (not that intuitive but hoping that it will work). Will switch over to Michael’s new code once available thru the app. :smile:

As such a momentary switch should work, right?


#16

Yes, if you use a momentary switch you don’t have to change it to the other state before you can use it again. It always puts itself back to off.

The alternative is just what you did: use a binary switch but make sure that there is something set up to turn it off so it will be ready the next time you want to turn on.


(Ron S) #17

Borrowed totally from @MichaelS. All credit to him.

Attempt to trigger home phrase via momentary button tile.

I intend to use it for Alexa, Turn on night mode.

In the app below:

  1. Will select a momentary button tile,
  2. Will select my GoodNight! Hello Home phrase.

Disclaimer: Use at your own risk. :wink:

/**

  • Alexa Home Phrase Executor
  • Copyright 2015 Ron S
  • Version 1.0.0 09/01/15
  • Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at:
  •  http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
  • on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
  • for the specific language governing permissions and limitations under the License.
  • Ties a Hello, Home phrase to a switch’s (virtual or real) on/off state. Perfect for use with IFTTT.
  • Simple define a switch to be used, then tie the on/off state of the switch to a specific Hello, Home phrases.
  • Connect the switch to an IFTTT action, and the Hello, Home phrase will fire with the switch state change.

*/
definition(
name: “Alexa Home Phrase Executor”,
namespace: “rsarkar”,
author: “Ron S”,
description: “Ties a routine to a momentary button tile to be used by Alexa.”,
category: “Convenience”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”,
iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)

preferences {
page(name: “getPref”)
}

def getPref() {
dynamicPage(name: “getPref”, install:true, uninstall: true) {
section(“Choose a Momentary Button to use…”) {
input “momentarySwitch”, “capability.momentary”, title: “Switch”, multiple: false, required: true
}
def routines = location.helloHome?.getPhrases()*.label
if (routines) {
routines.sort()
section(“Perform which routine when button is pushed…”) {
input “routine_on”, “enum”, title: “Switch is pushed”, options: routines, required: false
}
}
section([mobileOnly:true], “Options”) {
label(title: “Assign a name”, required: false)
mode title: “Set for specific mode(s)”, required: false
href “pageAbout”, title: “About ${textAppName()}”, description: “Tap to get application version, license and instructions”
}
}
}

page(name: “pageAbout”, title: “About ${textAppName()}”) {
section {
paragraph “${textVersion()}\n${textCopyright()}\n\n${textLicense()}\n”
}
section(“Instructions”) {
paragraph textHelp()
}
}

def installed() {
log.debug "Installed with settings: ${settings}"
subscribe(momentarySwitch, “switch”, “pushHandler”)
}

def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
subscribe(momentarySwitch, “switch”, “pushHandler”)
}

def pushHandler(evt) {
if (evt.value == “on” && routine_on) {
if (routine_on){
location.helloHome.execute(settings.routine_on)
}
}
}

private def textAppName() {
def text = “Alexa Home Phrase Executor”
}

private def textVersion() {
def text = “Version 1.0.0 (09/01/2015)”
}

private def textCopyright() {
def text = “Copyright © 2015 Ron S”
}

private def textLicense() {
def text =
“Licensed under the Apache License, Version 2.0 (the ‘License’); “+
“you may not use this file except in compliance with the License. “+
“You may obtain a copy of the License at”+
”\n\n”+
http://www.apache.org/licenses/LICENSE-2.0”+
"\n\n"+
"Unless required by applicable law or agreed to in writing, software "+
"distributed under the License is distributed on an ‘AS IS’ BASIS, "+
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. "+
"See the License for the specific language governing permissions and "+
“limitations under the License.”
}

private def textHelp() {
def text =
"Create a momentary button tile from IDE. Expose the switch to Alexa. Tie a routine through this app. " +
"Use command like Alexa, Turn on Night Mode (where Night Mode is the group name which has your device. "
}


(Micheal ) #18

Nicely done! I may actually borrow some of your text from the help section on the app I am releasing this weekend.


(Pete) #19

I followed the instructions from the OP but my Echo won’t discover the virtual switch. Either simulated or momentary. It shows up and functions as expected in my ST app though. Any suggestions? Is there some device authorization step I’m missing?


(Ron S) #20

Have you exposed the switch to Echo from ST and then discover new devices? And please use @MichaelS code rather than my quickly thrown half baked stuff.