FAQ 2017: Have Alexa/Google Home/IFTTT run a routine, change a mode, or arm/disarm Smart Home Monitor (SmartThings Classic)

Echo and Google home only recognize some device classes, specifically lights, switches, thermostats , and maybe locks.

The official SmartThings/Alexa integration can run routines, but only routines that are limited to the device classes above.

IFTTT has the same issue. The SmartThings service/channel can turn a single device on or off, but it doesn’t show routines or modes or smart home monitor status.

So how can you use your voice assistant or IFTTT to change your mode, unlock a lock, or change smart home monitor armed status if the voice assistant/IFTTT won’t work with those kinds of devices?

Fortunately, it’s easy. :sunglasses: All you need to do is create a virtual switch and then have that virtual switch coming on turn on whatever routine you want.

The echo/GH/IFTTT won’t even know that the routine exists, it just thinks it’s requesting that a switch be turned on.

But since a routine can run automatically once a switch comes on, that’s all you need.

  1. create a virtual switch and give it the name that you want to use with echo. I’m going to call mine “nighttime.”
  1. create a routine that does whatever you want. It could change the mode. It could set the smart home monitor armed state. It could unlock the lock. It doesn’t matter because echo will not even know that this routine exists.

  2. towards the end of the new routine, choose the “automatically perform” options. Here you are going to specify that the routine should start automatically when your new virtual switch comes on.



If you use a momentary switch, it will turn itself off again as soon as echo turned it on, so it will always be ready for the next time.

If you use a binary switch, you should put turning that switch off inside the same routine, again, so it will be ready for the next time.

  1. now you just have to authorize that switch for use by Echo. So go to the smartapps tab under automations, select the alexa smart app, and make sure your new virtual switch is authorized.


Then tell echo to “discover new devices” and you’ll be ready to use your new switch! Which in turn will trigger your routine, no matter what the routine does, echo won’t care. :sunglasses:

The next time I say, “Alexa, turn on nighttime” my routine will run.

I believe Google Home will pick up all switches anyway, otherwise there should be a similar authorization step. But the main point is the same, the voice assistant doesn’t know it’s running the routine, it’s just requesting that the switch turn on.

(We used to have a much longer FAQ for this because you used to have to add an additional smartapp in order to run the routine when the switch came on, but now that is built into routines themselves, so now it’s easy. Create a switch. Have the routine automatically run when that switch comes on. Authorize echo to use the switch. Done. :sunglasses:)

More Uses: Daisychaining Routines, IFTTT changes Mode, etc

By the way, this is also how you have one routine trigger another routine. Have the first routine turn on a virtual switch and have the second routine run automatically when that switch comes on. Again, just remember to turn off the virtual switch again in that second routine so that it will be ready for the next use. You could also have multiple routine subscribe to the same virtual switch if you want. It just depends on exactly what you need.

And steps one and two are how you get IFTTT to run a SmartThings routine. Have turning the virtual switch on be the “THAT” in your IFTTT applet. Now you can have anything you want be the “IF” and the result will be a routine running in SmartThings. And that routine could change the mode, change the smart home monitor armed state, turn on a group of lights, etc.

All of these work because a routine can run automatically when a virtual switch turns on. :sunglasses:

Changing the “If” in IFTTT

The same method can be used to create an “IF” condition in an IFTTT applet.

Just have a routine or smart lighting automation or webcore turn on a virtual switch, and then have that virtual switch be the “if” in your IFTTT applet.

That way you can have very complex logic for firing the applet if you need it.

12 Likes

Folks, great posts, very helpful. 1 quick question. I am using a virtual switch in smarthings triggered by Alexa to trigger a hello home routine, disparate events/commands work great as long as I don’t use any other mechanism to open or close what the virtual device triggers.
Example:
Alexa: Turn on the work shop (workshop group in Alexa has some lights and a virtual switch (regular on/off not a momentary) that triggers a routine that opens a garage door). Everything works great.

I then exit the workshop and like a good resident, close the overhead door. Now I have the problem where the virtual switch is in the “ON” state. If the next time I tell Alexa to “Turn on the workshop”, the switch will not transition so the routine never sees the trigger and the door won’t open. Is there a way to trigger the virtual switch to reflect the state of the overhead door so that when I do close it manually it is in the right state ?

Thanks again for all the faqs.

There are many different ways to do this, but I think the most common is to use the virtual switch that turns itself off immediately so it’s available for the next on.

There are two different ways to do this depending on the kind of Virtual you’re using.

If you are using a binary switch, one that stays on until you turn it off, just set up a separate “power allowance” smart lighting automation so that it will turn itself off after one minute. Then it’s available for the next “on.”

Note that you select your virtual switch and then say you want to turn it off, and then choose “power allowance exceeded” as the trigger.

The other way to do it is to use a momentary switch instead of a binary switch. A momentary switch is like a classic doorbell: it’s off most of the time, then when you turn it on it’s on for a moment, then it turns itself off again. Just choose “momentary button tile” as the device type when you create the virtual switch, and it will automatically have this behavior. :sunglasses:

Both ways work, it’s up to you which you want to use.

I had a few concerns with using this method.

  1. If you have the smart app change the virtual switch to off, won’t that trigger any routines that are triggered by the transition to the off state for that switch?
  2. If I set it back to off, then trigger the virtual switch to “off” from Alexa, it will do nothing since it is already in the off state.

I can use the momentary switch, 1 for close and 1 for open, but then my alexa app group could not turn on or off the room via a single command like I can with the binary switch. There is a certain beauty of being able to simply tell Alex turn to turn off a room.
I would think this problem exists for simple lighting situations as well when there is another mechanism to turn off or on switches that are triggered by the virtual switch.

Thanks

Yes, if you’re also using the “off” state of the virtual switch for information, and that method won’t work.

You asked if it was possible to know if the door was closed. It just depends what sensors you have on it. What device closes the “overhead door” now? And is that the same as the “garage door” which gets opened when you go in? Or is it a different door?

How do you turn the lights off now they get turned on with this group?

Do you always work with the door open or do you sometimes work with the door closed?

As mentioned, there are many different ways to approach this, it just depends on the exact details of the use case. :sunglasses:

I have 2 rooms I’m trying to apply this logic to, Garage and Workshop. Both have Linear GD00Z-4 Z-wave garage door openers and z-wave GE Z-wave light switches and Kwikset 910 Z-wave locks, I believe both the Linear and the Kwikset have state information.

I would like to be able to open or close the garage door in any of the following 4 ways:

  1. Manually with the garage door switch (coded or otherwise)

  2. Via the smart things app

  3. Via Alexa by saying "Turn off ‘virtual switch 1’ "

  4. Via Alexa by saying “turn off workshop” where the workshop group in alexa contains all of the lights, door locks, garage door openers etc…

    I can accomplish items 1-3 just fine, item 4 is the problem. I am not able to control which method of “turning on” or “turning off” a room is executed (Wife and friends).

Sometimes I work with the door open. sometimes not. Another good example of this is as follows:

  1. I tell alexa to turn off the Garage, Alexa togles virtual switch to off which triggers Linear to close the garage door. The state of the virtual switch is now “OFF”
  2. Wife drives home afterward and opens the door with standard garage opener (I am not going to train the wife on proper garage door etiquette… )
  3. Smarthings thinks virtual switch is “OFF”
  4. Someone tells Alexa to “Turn off the Garage”. If the lights were on, they are now off since their state is known, if they were already off, that’s fine too. The virtual switch “VGarage” is now set to “Off”, no change occurs from it’s previous state, hence no trigger of the routine to close the Linear controller, garage door stays open all night, raccoons now have a home, wife is pissed, smarthome is disabled, all residents now have to get off their butts and manually turn off switches and close doors.

I think if I can trigger the state of the virtual switch by the position of the linear door opener, it will solve my problem. Ideally, I would prefer to do so without non-local device drivers or IFTT. Right now, the ONLY device that the virtual switch triggers is the linear controllers. I have 2 virtual switches:

  1. VGarage

  2. VWorkshop

    I added VGarage to the group “Garage” in Alexa, this group now contains:

    a. Garage Light Switch (GE)
    b. garage overhead door 1 (Linear)
    c. Garaget door lock (to be added later)

    I added VWorkshop to the group “Workshop” in Alexa, this group now contains:
    a. Workshop Light Switch (GE)
    b. Workshop Overhead Door 1 (Linear)
    c. Workshop Door Lock (Kwikset)

Routines:
“Close Workshop Overhead Door 1” will close the Linear controller in the workshop when the VWorkshop switch is set to “off”
“Open Workshop Overhead Door 1” will close the Linear controller in the workshop when the VWorkshop switch is set to “on”

Same for Garage.

I understand. However at this point we are very far away from the purpose of this FAQ thread. So could you please start a new thread copying your most recent post and then people can help you figure out exactly what will accomplish what you want.

You can start the thread in the following section of the forum:

https://community.smartthings.com/c/smartapps/smartapp-ideas

i like idea of NOT creatif a virtual switch bc it begins to add up. i try to avoid virtual switches all together if you have alexa. remove the devices from the routine that alexa cannot execute within it yet and just make a core piston that says if this routine is executed then perform the actions that alexa couldnt do in the routine at first

i think i should have put a “.” in there somewhere

1 Like

Hi Richard,
I’m not sure if you solved this, but everything you want done can be done easily using the smartapp EchoSistant.