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

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.

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?

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?

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.

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?

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)

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.

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

1 Like

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

4 Likes

You are the man! 20 chars!

Totally Awesomesauce! LOL :sunglasses:

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!!!

2 Likes

@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?

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.

1 Like

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. "
}

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

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?

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.

1 Like

Given how flaky things have been on the platform for the last 24 hours, it may well be a platform issue.

But it should be discoverable once you have authorized it in the smartthings Amazon echo smart app.

In the new app you need to go to the things view (4 little squares for an icon at the bottom of the screen ), choose smartapps, then choose the Amazon echo icon.

This will show you the List of devices that you currently have authorized for echo to use. Click on the + to add more. Then click on the “next” at the top of the screen.

You will then see a new page telling you to instruct echo to discover the new devices. Do that, and wait until echo tells you it is done. Then click the done at the top of the screen in the ST mobile app.

The virtual switch should then be available to echo. But again, if it’s not working right now it might be a platform issue.

1 Like

@JDRoberts @smart D’oh. You guys are right. I missed the part where I had to expose the switch to the Echo using the SmartApp. All is well now.

Also, I’m using the “Switch Activates Home Phrase” SmartApp to trigger the events when I say my voice command. What is the difference between this and the one from @MichaelS?