Alexa + SmartThings + IFTTT + Harmony to turn TV on and off by voice (2015 version)

Updated 12 November 2015 after Amazon added “Triggers” to their IFTTT Channel for Alexa

As valuable as I personally found this project, and as much as I learned in doing it, as of 12 November 2015 it’s now no longer necessary.

Amazon has added verbal triggers to their IFTTT channel. So you can say anything you want to as a trigger to Alexa and use that as the “if” for an IFTTT recipe, and have that trigger anything that has an IFTTT “that” channel. So SmartThings, Philips Hue, Harmony activities, etc. No virtual switches needed, no synch issues.

It really is that easy. :sunglasses:

If you’re new to IFTTT, here’s a good overview:

You may still want to use the direct Harmony/SmartThings integration to control certain aspects of TV watching, like limiting your kids to 30 minutes of Netflix on Tuesday’s when they’re the only ones home or whatever, but for that, you would use SmartThing’s Harmony smartapps, not the IFTTT channel.

I’m going to leave this project report up, because it’s still a good model for working with other IFTTT channels, but for basic Alexa/Harmony I would now suggest just starting from the Alexa side and using their triggers.

Which IFTTT recipes will you need?

As far as Which recipes you will need for the Alexa trigger method, that’s pretty straightforward.

You will need one recipe to start each of your regular harmony activities like “watch cable” or “Watch DVD.”

Plus you will need one more recipe to end an activity to turn off the power to your master a/v device. This can be any activity that includes that main power device, or you can set up a new Harmony activity that only includes the main power device. In my set up, my TV is my main device. When it goes off, my DVD and Roku also go off. (My cable settop box is an always on device.) other people may have their sound bar as their main device or a theater controller. Just create a recipe that ends the activity that turns off your main power device. I have Alexa call that “shutdown.”

If you have any other Harmony activities you want to control through echo, just create one recipe for each one to start it.

The only exception is for harmony activities that you might want to do more than once in a row. For example, because I want totally hands-free control of my harmony, I want to be able to turn the volume up and turn the volume down through Alexa. I can create a harmony activity that just does volume up, but I can’t do it twice in a row. So I have to have two volume up activities and two volume down activities so I can switch between them. This is pretty clunky, so most able-bodied people will probably just use the button remote for volume, but it’s useful for people like me who really need hands-free controls.



The following method is based on the original echo/Smartthings integration. That was updated for 2016, and the new method creates its own virtual switches, so most people will want to use the new method instead. I will post a link to that thread in a minute.

I am going to leave the rest of this thread here because there’s a lot of very valuable information on how harmony activities work and how to set them up which will still apply even with the new SmartThings integration.

But at this point, you can really just skip the entire rest of this post and either go immediately to the thread on the 2016 method, or read through some of the reply posts to this one if you want ideas on setting up harmony activities.


This method gives you natural language voice control to turn the television on and off and switch between harmony activities. The main method does not give you control of the volume or fast forward. But it’s very nice to have. (I’m quadriparetic, so I use voice controls as much as I can.)

It’s very simple as long as you use momentary switches. I use the “momentary button tile” device type in the IDE. As others pointed out in the Echo topic, the use of momentary switches means you don’t have to worry about keeping your voice commands synchronized with the physical button universal remote. You can switch between them as much as you like.

You just need one momentary switch for each Harmony activity you want to turn on and one extra momentary switch to power off everything.


I created a Room called “Entertainment Center” with four virtual switches: TV, cable, Roku, and a DVD player.

I will have four harmony activities: Watch cable, watch Roku, watch DVD, and power off (which turns off the TV and the other devices are slaves to it).

So I added four momentary button tiles in SmartThings: Cable virtual, Roku virtual, DVD virtual, and TV (which turns off the power).

If you have never created a virtual device in smartthings before, here’s the FAQ for that. It’s easy. Just choose “Momentary button tile” as the new device type if you want to use the same one I did.


I authorized them for use in echo and IFTTT. I didn’t need to authorize them for harmony because I’m not turning them on and off from the universal remote.

I started with authorizing them for IFTTT. Choose the Rooms view, then SmartApps. You will see an IFTTT smartapp.

Open it, and you will see the list of devices you have already authorized for IFTTT use.

Tap on the green plus sign to open the list of all SmartThings devices. You can add or remove them here.

When you are finished, tap Done at the top right of the screen. This will return you to the list of authorized devices.

Tap Done at the top of that screen.

Now you are going to repeat the authorization process, but this time authorizing the switches for use by Echo.

Again, start with Rooms view and select Smartapps. This time choose the Echo app.

You will see the list of devices you have previously authorized for use by Echo. Tap the green + to open the full list of SmartThings devices at this location…

When you have finished marking all the devices that you want echo to be able to control, tap Next at the top right of the screen.

Now discover them in echo, then tap Done to complete this step.


Because we are going to use momentary buttons for our virtual switches, we will not be able to turn off the virtual switches by voice. We can only turn them on. So we are going to create one extra harmony activity that will be only used to turn everything off.

In my case, I already have the Roku and the DVD player slaved to the TV. So I just need an activity to turn off the TV, and all the other activities will be turned off, and all the devices will be turned off except the cable settop box, which is what I want.

(It turns out that if your television has to be turned off with what harmony calls a “manual” command, rather than a code, then it is possible for things to get out of sync if someone presses the physical button on the television to turn the power on or off. This is a known harmony issue. If you have one of these type of televisions, and run into this problem, see the discussion in the posts below this FAQ for various approaches to the situation. But as long as your television turns off with a code, the momentary button takes care of any synchronization issues. )

So here are my four Harmony activities:

And here you can see that ending the power activity does nothing except turn off the TV. This is the one I am going to control with the “TV” virtual switch.


Since these are momentary switches, you don’t have to worry about setting up separately for an on and off state. When you give the voice command, the button will act as though it was briefly pressed on and then turned off again. This is why it can’t get out of sync.

I set up four IFTTT recipes:

  1. if SmartThings “cable virtual switch” turns on, start harmony “watch cable” activity.
  2. if ST “DVD virtual switch” turns on, start harmony “watch DVD” activity.
  3. if ST “Roku virtual switch” turns on, start harmony “watch Roku” activity.
  4. if ST “TV virtual switch” turns on, end harmony “power” activity.

So you are going to start all the device activities, but end the one extra power activity.


You can put the switches into individual groups of one through the echo app if you want the name that you say to be different than the name that shows up in your smartthings mobile app.

I like to see the word “virtual” on the switch in the mobile app, but I don’t want to have to say it. So for example I put the switch which is named “cable virtual” in SmartThings into an echo group by itself that’s just called “cable.” Also, if one person always says “TV” and another person always says “television” you can just have two different Echo groups that each have the same one virtual switch in them. I put the “TV” switch into a group called “Exit Routine.”

My Alexa voice commands are:
“Alexa, turn on Cable.”
“Alexa, turn on DVD.”
“Alexa, turn on Roku.”
“Alexa, turn on Exit Routine.”

The first three can be used to either start the TV and that activity, or switch from one activity to another when the TV is already on.

The last one, Exit Routine, can be used no matter which activity is currently running. Note that I’m saying “turn on Exit Routine” even though that Harmony activity is going to end. “Turn on” in this context means “press the button.”

And because Echo is a natural language parser it will figure out variations of each of these voice commands. I could also say “Alexa, turn the DVD on” or “Alexa, switch on the DVD” and echo would figure it out.

So that’s just one example of how to use the new echo/SmartThings integration. :sunglasses:

Before this, I was using Siri to send a voice text to IFTTT. It worked much the same way, but the voice commands were much more awkward and you had to say them exactly the same way each time.

So I used to say, “Hey, Siri, tell House hashtag Roku underscore on.”

Now I can just say, “Alexa, turn on the Roku.”

It may not seem like a big difference, but if you use voice a lot it’s way easier.


There are a lot of variations you can do with this. I’m not going to write out all the instructions for each, but I will summarize some of the ones that community members have shared and if you have questions about them, ask them below. Please reference the section number so we know which one you’re asking about.

6A. Adding Favorite Channels, like “Turn on ESPN TV” or “Turn on the Disney Channel.”

@Mbhforum points out that since Harmony lets you start an activity with a particular channel, you can set up an activity for that specific channel, give it its own virtual momentary switch, and you will have an Echo voice command to go straight to that channel. Nice! :sunglasses:

One caution: anytime you are making Harmony changes, only do a few at a time and then save. Harmony does some kind of internal refresh that can lose changes if you do a whole bunch at once.

@Mbhforum reports also that he had more success putting the starting channel in as part of the starting sequence, not using the start channel field. See his posts below. Apparently there is a harmony bug if you have multiple activities with a different starting channel for the same device. But if you set the starting channel in the “start sequence” for each activity, it works OK.

6B. Adding a regular switch to allow for the voice command “Turn TV Off.”

My least favorite part of my own method is that you have to say “turn exit routine on” to turn off all the power. Another community member, @zj4x4 , offered a modification. If you make the extra switch a regular binary on/off switch instead of a momentary toggle, and you add turning on that switch to every other harmony activity, you can then use turning off the exit switch to turn off the power instead of having to turn it on.

So in his method, you get to say “turn TV off” which is obviously much more natural language.

I really like his method, and I am going to use it myself, but it is somewhat more complicated because now the extra switch is handled completely differently than the individual activity switches. Here’s his explanation:

This variation requires the following changes:

Make the virtual power switch a Simulated Switch in the IDE instead of a momentary button tile.

Authorize Harmony to access that switch. (You only need to authorize Harmony for the one power off switch, not the momentary switches.)

Now for every Harmony activity you have except the Power Off activity, add turning on the virtual power switch to the start sequence. That way you’ll be able to use the power off voice command.

Finally, change the IFTTT recipe so if the virtual power switch is turned off, Harmony will end the power off activity.

You also have to remember every time you add a harmony activity in the future to add turning on the exit virtual switch to its start sequence or “turn TV off” won’t work by voice for that particular activity.

So like I said, I like this method, I’m going to use it myself, but it is certainly more complicated than using “turn on exit routine” with a momentary button because you have to make sure the binary switch gets turned on so you’ll be able to turn it off again later.

6C. Turn the TV on or off as part of a Routine or Mode Change

@MichaelS is working on a new smartapp called “Alexa Helper” to make it super easy to assign virtual switches for Echo to use to change modes or Routine. That way you could make turning off your TV part of your “Good Night” Routine.

For those interested in this approach, see his topic:

6D. Granular Control of Individual Remote Buttons like Pause and Rewind

Turns out there is a way to do this for some devices, but it’s a lot of work to set up and the voice commands are a lot clunkier than the ones we’ve been using so far. It’s useful to me as a quadriparetic, but I’m not sure ablebodied people would find it worth the effort. Anyway, discussion of this was added to the thread in Post 90 below on September 1, 2015.

A friend of mine who uses switch control mentioned that harmony activities can go down to the granular level (pause, play after Pause, Rewind, etc) but you have to put them in as a “step” in the activity. And the trick I hadn’t realized is that you have to also include whatever device controls the power for your home entertainment system. Otherwise switching to the granular activity will shut down the TV.

6e. Skipping IFTTT and using the Harmony Triggers smartapp instead.

At the time of this writing, the smartthings direct integration with harmony, using a smart app called “Harmony triggers” was still in beta, and not fully baked. Once it is working reliably for everyone, you’ll be able to leave out the IFTTT part of this process, and instead of setting up an IFTTT recipe to respond to each virtual switch, you’ll set up a trigger in the Harmony Triggers smart app. Otherwise everything else will be exactly the same.

If you don’t know how to find/use the Harmony Trigger smartapp, see the following FAQ:


And in case you haven’t linked your SmartThings to your Echo yet, this FAQ might be of interest:

This won’t work if your TV only has toggle on/off instead of discrete on/off codes. Correct?

The harmony hub can control devices with either power mode. I have both types of devices in my AV system. Some have a different code for off/on, some have a single toggle.

But harmony handles all of that. You’re just sending a command to harmony through ST/IFTTT.

1 Like

That’s correct. I’m just saying with toggle mode only if someone shuts the TV off by pressing the power button on the TV itself things get out of sync

No, nothing gets out of sync.

All of the virtual switches in this set up are “momentary.” They are like a typical doorbell button. Most of the time the button is “off”. When you press it, it very briefly goes “on” and then pops itself back to the “off” position.

Since the virtual button is always “off” unless you have just given a command, it is always ready for the next “on” command. So everything stays in sync if you turn it off with a physical button on the TV, with a button on the manufacturer-supplied remote, with a button on the harmony universal remote, or using this method to give Alexa a voice command.

That’s the main reason for using a momentary switch, because otherwise you have to turn it off again before you can turn on the next time, and then, indeed, things could get out of sync.

Of course this is a virtual switch, so it’s a virtual momentary press, but it’s the state change that matters and that works like the doorbell button.

My thanks to @schettj @Dlee @Mbhforum and others in the Amazon topic for helping me simplify my original switch set up by using the momentary switches. :sunglasses:

OK, maybe I’m doing something wrong. My tv is toggle only. I use a momentary switch in smartthings. I tell Alexa to turn tv on (works great). I leave the room, wife walks by and presses the power off button on the TV. I come back see tv off tell Alexa to turn tv on… Nothing happens because harmony still thinks it’s in the turn tv on activity. I pick up the Harmony and end the activity only this time the TV turns on because it’s toggle not discrete off code.
If I can fix this please tell me how

I’m not sure exactly, but it sounds like it would be a problem you could re-create if you were just using the harmony tablet app or even the harmony universal control to start the activity and then you used the toggle button on the physical TV to turn the power off. That is, it’s a problem you would have even without smartthings in the mix.

If that’s true, you should be able to get help from Logitech or the harmony forums to figure out why your activities are still showing as active when the TV power has been turned off.

Once you get that straightened out without any smartthings involvement, then your momentary switches should work fine.

I ran into the same situation, it’s a flaw in Harmony design and no way to go around it. Been on the phone with Harmony support, have actually a ticket for ‘future development’. The power off button only turns off the AV devices, which defeats the purpose of Harmony as home automation hub. They should provide a way to turn off that button at least, or allow users to repurpose. Anyway, I was working on a similar integration to use Alexa to turn on different activities but instead of using the IFTTT, I wanted to use a contact simulator. I dropped the project because I started the migration clean up. But if anyone has time, using a contact could trigger the activity in Harmony, without using IFTTT. The advantage would be that when virtual contact opens, starts the activity, when virtual contact closes, it ends the activity.

I see.

You could probably set up one voice command that would trigger multiple IFTTT recipes each of which turned off one harmony activity. So saying “Alexa, toggle” or whatever you wanted to say would get everything cleared.

If you don’t have an echo, you can do the same thing just using one momentary virtual switch in the smartthings app as the IFTTT trigger. So you press one tile, everything clears.

A little hokey, but it would probably work.

For techie people, here’s what a momentary button tile device looks like in the IDE:

From the “my devices” screen choose the “add device” Green button in the upper right. The “momentary button tile” will be one of the drop-down choices for “device type” on the new device details screen. Fill in the other details and save it. It does not require any special code. It will immediately show up as a tile on the things screen in the smartthings mobile app.

Here’s what the momentary button tile Device will look like in the IDE after you have created it and authorized it for use by IFTTT and echo.

And here’s what the event log looks like when it’s used with echo. Echo sends the on command, then like a doorbell button the virtual momentary button tile goes on and then back to off. This leaves it ready for the next on command.

Is the template for the code available in IDE? Or how did you install it? I have several on/off tiles for which I set a timer to turn off. This looks much more efficient.

It’s a standard device type available in the ID. When you go to add device, it will be one of the drop-down choices for Device Type. I’ve added another screenshot in the post above.

1 Like

Actually, it sounds like @johnosstyn issue isn’t with IFTTT/Smartthings/Harmony. It sounds like your issue is family members not using the harmony remote. If they turn it off manually at the device (TV in this case), then it will get out of sync with Harmony. Harmony still thinks the activity is running so you can’t run it again. You just need to get your wife onboard with using the remote for A/V stuff. But that’s how I read it.

Would be much easier to just pop out the off button than changing wife’s behavior. But when you pay as much as you pay for these remotes, having a whole in it doesn’t look as nice.

And there is another ‘super smart’ functionality on Harmony that I ran into. You cannot turn the outlet on before the TV from one activity. Genius design.

Another alternative would be just to create two Harmony activities that do the same thing. Harmony automatically turns off the previous entertainment activity when it starts a new one.

So you could have one activity called “watch TV” and another activity called “watch television” that do exactly the same thing.

Now set up two virtual momentary switches, one for each of the two activities.

So you say “Alexa, turn TV on.” And if that doesn’t work you just say “Alexa, turn the television on.” If the first one didn’t work because someone manually hit the button on the TV itself, leaving the “watch TV” activity running from Harmony’s point of view, starting the “watch television” activity should work anyway, automatically turning off the “watch TV” activity.

So did like the parent who says “Jimmy, time for dinner.” And if Jimmy ignores them, the parent says "James David Roberts, get in here now! " LOL :sunglasses:

Or am I misunderstanding something?

You guys are correct. Harmony can only keep track of what harmony does. If the original remote is used or tv button is pushed things get screwy. I guess I can try training the wife (yeah right) maybe I’ll hide the original remote in the trunk of my car :smiley:

1 Like

Try just setting up a second harmony activity that does exactly the same thing as the first one, but has a different name. Then if the first one doesn’t work, just use the second one.

Retraining other people is always my last choice for solving a household problem. :wink:

1 Like

I was just about to toss my original remote but then Harmony pushed an update and broke my Motorola STB functionality.

Tried that yesterday JD, Problem is being toggle on/off Harmony remembers it toggled the tv on in a previous activity so it won’t do it again in another activity :frowning: . I also tried when smartthings tv on fired it would turn the tv on, then when the momentary switch turns off i had it run a “fake” activity called do nothing (turned a device on i don’t even have) thinking that would get Harmony off the first activity, which it did , however running the original activity did nothing because harmony knows it turned the tv on at some point. only way i see around this is a tv with discreet on/off codes…