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

@johnosstyn, can you explain exactly what you did? I attempted to do the same but can’t get it to work. This is what I tried to do to keep everything in sync…

  1. Created a virtual switch and used the echo and logitech harmony control app instead of IFTTT.
  2. Used the Harmony app to engage the virtual switch at the end of my “Watch TV activity” start sequence.
  3. Used the Harmony app to disengage the virtual switch at the end of my “Watch TV activity” end sequence.

I figured this would keep everything in sync, regardless if I used echo or the remote.

For example, if I asked Echo to turn on the TV it would initiate the virtual switch and turn everything on. The virtual switch would be on and I could then turn the TV off with the remote or Echo.

If I turned the TV on with the remote, the harmony activity would turn the virtual switch on as well. This way I can turn the TV off with the remote or Echo. However, this set up didn’t work. As soon as I turned on the TV my TV turned on and off in an endless loop.

I really like the idea of having just the single virtual switch to turn a harmony activity on and off. Would appreciate some ideas. Thanks!

@mikecoscia
I created a momentary button tile switch. When Alexa is told to turn on OR off of this type of switch, the switch toggles on then off again.

So in smartthings harmony app tell it when the switch turns on, run the turn on tv activity, when the switch turns off exit the activity . This way the Harmony remote is never sitting in an activity so everything stays in sync. problem is when Harmony exits an activity it wants to turn the device off. to prevent turning off the tv go into the harmony app and

  1. harmony setup
  2. add/edit devices & activites
  3. devices
  4. pick your device
  5. power settings choose ----> (keep device always on but switch off when off button pressed)
  6. press the arrow on the right at the top of the screen
  7. choose (using two different buttons)
  8. press the arrow on the right at the top of the screen
  9. power on (choose your power toggle button), go back and set your power off button to something that does nothing (i choose up arrow)

when the above is all setup

you say “Alexa, turn the tv on” the momentary button turns on, harmony starts the power on activity (sends power command to your tv) a few seconds later the momentary button shuts off causing harmony to exit the activity (it wont turn the tv off because it sends the up arrow)

Now when you say “Alexa, turn the tv off” the same thing happens this time causing the tv to turn off.

Since harmony is never left in an activity, this all works no matter if the tv was Manually turned ON/OFF or was turned on/off with the original remote.

1 Like

Just make sure you don’t use a harmony activity to set channel as a start sequence aka if you say “Alexa, turn on Comedy Central” when TV is already on and tuned to CNN, it will turn off (on sequence being toggle) the TV, send channel number for Comedy Central to STB, and hit up arrow.

Likewise dont turn off the tv when it’s already off. That sounds self explanatory, but I currently do this via routine that fires when everyone leaves. I turn off all my lights, turn off the tv, and lock the door. If you fire this sequence when TV is already off the start sequence will turn it on ( toggle).

You are right Scott. I use this method to just allow me to turn my TV on/off with voice commands to alexa. My tv does not have descret codes so even changing inputs using harmony gets wacky after a while.

I also use this method to control a fan I have via harmony. Both the fan and tv are plugged into a power strip that I have toggle off then back on when I leave or use the good night routine in smartthings.

If I had descret codes, I’d probably still use this method, but would set up another device in harmony with the exact same model number and call that one “Alexa tv control” and leave the other device for more complicated activities.

I don’t think you can use your wake word in your device name, can you?

That is “Alexa, turn on Alexa switch” won’t parse correctly.

I think everybody’s going to find different phrasing natural. You just have to find the ones that work at your household.

For example, I say:

“Alexa, turn on cable” (or “Alexa, turn on Roku” Etc")

And “Alexa, turn off TV.” I don’t use “turn on TV.”

But it’s all a matter of what feels right to you. :sunglasses:

I use “Alexa, turn on tv” and “Alexa, turn off tv”. The other device I’d set up is in the harmony app itself. So if had a device named “alexa tv control” in harmony I’d use that for the method above and just tie the TV switch to run activities on that device, I’d could then set up another device in Harmony and run activities off that device where I didn’t want the momentary switch to exit the activity and throw a fake off command. Does that make sense?

Both devices would be the exact same model so harmony would send the same ir codes, I’d just have different ways to exit activities.

They way I described above is just to turn the TV on/off using one switch and everything stays in sync. Using it to turn on a cable box or roku, switching inputs probably won’t work. The method works for me because I rarely watch TV and don’t have cable and the need for different input, I just turn the TV on for background noise.

1 Like

Sure, that makes sense, and again this is something where there’s going to be a lot of variation because people do have very different entertainment center set ups.

The basic concepts are the same, but even so you do have some choices to make between momentary switches used to turn on, momentary switches used to turn off, binary switches used to turn on, and binary switches used to turn off. The exact combination of tools that works will depend on both the set up and the person’s preferences for the voice commands they want to use. :sunglasses:

Yes it works both ways…See this thread

I have my Harmony hub added to ST and the Logitech Harmony trigger app added. I created a action in the trigger to start the TV activity and it works fine from ST.

I have searched the threads, but can’t find out if Alexa can connect to the trigger via a virtual switch? Do you have to use IFTTT in order to give voice commands?

You don’t need to Use IFTTT anymore, at the time this was written the Harmony/smartthings integration was still in beta. You’re going to use the “harmony triggers” smart app instead of an IFTTT recipe. Everything else is the same. The point is that a virtual switch is treated exactly the same way as a regular switch once it has been created. So echo will just think it’s a regular SmartThings switch.

Here’s the harmony triggers FAQ.

Wow, got it all working, but man I need a drink :smile:
I also got all the home control buttons on the Harmony remote controlling all my lights and plugs!

Amazing technology for $99.

1 Like

I just got a hub off eBay to do just this. If works well will get another to set movie mode in downstairs theater, is the remote worth getting or is it fine just plain hub? I got the anymote off Kickstarter hoping it would do this but so far it’s a dissapointment

The remote is not needed if you carry your smartphone with you and have it available to control the hub. You also can use an iPad or Android pad to control the hub. The remote does have some nice easy to access features where on your smartphone there may be four pages of commands you have to scroll through to find what you want.

It has taken me two weeks to get my Amazon Echo + SmartThings + Harmony Home Control to work properly. It’s been painful, but I’m LOVING the results! I have also installed/configured SmartTiles. So, from ANY browser/device, I can not only see what’s happening at home, but also control it!

I didn’t create momentary buttons/switches. Instead, I created “normal” virtual switches (aka Simulated Switches.) I then leveraged the Logitech Harmony Trigger “smart-app” to fire based on these switches being turned “on.” This Trigger then kicks-off the respective “Activity” on the Harmony hub.

Side note: Initially, I couldn’t get my Harmony hub to be discovered by SmartThings. The “issue” = I had a “ghost” hub entry in MyHamony. This was causing somewhat of a naming conflict with SmartThings (e.g. two hubs, with the same IP address?..) Once I deleted the ghost entry, everything paired-up perfectly. How did the ghost entry occur in the first place? Reason: Initially, my laptop was broken. So, I installed the MyHarmony app on my wife’s laptop, and configured the Harmony hub/remote/keyboard. When my laptop was finally revived, I installed the MyHarmony app onto my laptop, and then tried to change/update my Harmony hub. Instead of just seeing/changing the EXISTING hub, it created a whole-NEW hub within the MyHarmony app. Again, I just deleted the unused/ghost hub, and everything installed “business as usual,” thereafter.

What I then did, was set-up “home automation” device events within the Harmony activities. These “control” the status of the “virtual/simulated switches.” e.g. When the TV is turned off, it then turns-off the SmartThings switch, too (via the Exit Event.) My media server is hooked-up to the TV, too. And, I also have an activity that launches a smart-app (Plex) on the TV. So, no matter which activity I run – my “switches” reflect an ACCRUATE status (on when on, and off when off.)

The only thing that I had to do “special,” was create a unique “all off” switch. I simply created a simulated switch named “Entertainment Center.” So, if/when I want to truly turn things off, I just say, “Alexa, turn off the entertainment center.”

Results:
“Alexa, turn on the TV.”
“Alexa, turn on Plex.”
“Alexa, turn on Merlin.” (That’s the name of my PC media server.)

I can say any of the above when things are off, or on.
If I’m watching TV, I can then say, “Alexa, turn on Merlin” – and the screen will change to HDMI-2, and my PC will use the TV as a monitor. Similarly, my Harmony keyboard “changes modes,” too (and indeed WORKS with the PC!)

But, I can NOT say:
“Alexa, turn off TV.”
“Alexa, turn Merlin.” nor
"Alexa, turn off Plex."

Instead, I just say, “Alex, turn off entertainment center.”

On top of all that, I’ve ALSO added most of our channel-changing operations into the same set-up.
So, we can say,
“Alexa, turn on ESPN.”
“Alexa, turn on TNT.”
“Alexa, turn on Bravo.”

Again, I have Smart-Tiles for ALL of this. So, I can not only see if someone’s watching TV in our home, but I can ALSO see what channel they are watching!

As we change from one channel, to the next – the “active” channel switch/tile is illuminated as “on” – and the old/previous channel then goes dim/grey. Similarly all of these channel-changing events are now “logged” as “events” in SmartThings and SmartTiles.

Since I want the Echo (Alexa) to be as conversational as possible – especially for guests – I added “groups” within Alexa, to create “alias” names.

e.g. “Disney” is the name of my Disney switch.
So, WE would typically say, “Alexa, turn on Disney” – and she will (optionally turn on the TV-related stuff) and then tune to the Disney channel.

But, I have added the following “groups:” within Alexa:
Disney Channel
Disney Network
Disney TV
Disney Television
Disney Station

Each one of these groups only has one single device/switch (the “Disney” switch.)

So, if guests say, “Alexa, turn on the Disney Channel” – she will indeed switch to “Disney.”

This is especially true for long-name alias. WE say “TBS.” But, we have no idea how our visitors/guests will say it? They might say “Turner?” Or, “Turner Network?” or, “Turner Broadcasting” or “Turner Channel” or “Turner Broadcasting Station” or, incorrectly “Turner Broadcasting System.” So, I have aliases (groups) for ALL of these.

Yup, with DIRECT and hundreds of channels, it’s a LOT of devices, and even MORE “groups” within Alexa. But, we’re enjoying the results! We can be in the kitchen with something playing in the living room. If we don’t like what comes on next (while we are cooking, with dirty hands, etc.) we can just say, “Alexa, turn on _______.” – and then watch/hear something different.

Again, all of this WORKS if you also use the Harmony app on the SmartPhone, or if you manually kick it from within the SmartThings app, or via automated routines (e.g. HLN comes on automatically with the living room lights every morning when I activate the motion detector in the hallway – Monday thru Friday - between 6am and 8am PST.)

All of this also WORKS if I change the statuses via SmartTiles, too.

Sure, I wish cable/satellite companies would “get on the bandwagon” and make their devices “Alexa-compliant” – so we don’t have to use/configure all of these “middle-man” devices/scripts. PLUS, I don’t really adjust “button” types of events via Alexa. Thus, no volume control, no “guide,” no “exit,” no “select.” no directional arrows, no PageUp/Down, no “menu,” etc. After all, who wants to say, “Alexa, turn on the Guide. Alexa, turn on the down arrow. Alexa, turn on the down arrow. Alexa, turn on the right arrow. Alexa, turn on the right arrow. Alexa, turn on Select.” <— That’s just too unnatural, and too much gobbledygook!

Anyway, we wish you luck!!! It takes the patience of a saint to get all this figured out.

Peace.

2 Likes

Awesome! This is where I want to be. I currently just run “Turn on/off TV” and it updates a virtual switch so we can use Alexa, Harmony remote, or SmartTiles and it works. But I also have a Roku for Netflix, etc. So I will probably use your “Turn off Entertainment Center” idea.

How do you handle the channels? Do you have logitech activities setup for each channel? That sounds extremely tedious, but that’s the only way I could think of doing for the few channels we frequent.

Also, have you figure out a mute or pause by voice yet? Would it just be another logitech activity?

I’ll look it up also, but I haven’t heard of aliasing with Alexa… but it makes complete sense. Is it within the Alexa app or did you setup virtual switches for all of those different options?

If you start with post one in this project report, you’ll see how to do all of those things. You’ll also see the discussion of why most of us use momentary buttons for everything except the power off.

The reason is that when you use a momentary button it always returns itself to the off state, so it is ready to be turned on the next time. Otherwise you have the problem that if you start with “turn on Roku,” switch to “turn on Disney” and then “turn off entertainment center” the Roku and Disney switches may still be on so they won’t work the next time around.

Momentary buttons also solve the problem of some activities being started by voice and some being started by pressing buttons on the physical remote.

But again this is all discussed above.

If you have a different custom set up that you like a lot and you think others would benefit from, I encourage you to start your own project report thread so you can discuss the details of that.

“All home automation is local” and one of the things that is interesting about the project reports category is how many different solutions there can be two similar problems. Each useful to a particular group of people for a particular reason. :sunglasses:. But it’s usually better to keep each project variation in its own thread, or it can get really confusing for people coming in later.

Thanks! I’ve been reading through and I do understand the momentary button and will definitely implement that. What I don’t understand is channels. Do you have logitech activities (and ST momentary buttons) for every channel you want to be able to access by voice?

Yes.

Also an activity to pause, to rewind, to exit, etc.

Most able-bodied people will probably just grab the button remote. Since I’m quadriparetic, I couldn’t actually do a pause or rewind before so that’s worth the effort for me.

And because harmony will not let you do the same activity twice in a row, I have two activities for volume up and two activities for volume down and I can switch between them. Again, an able-bodied person probably wouldn’t bother.

Eventually, I’m sure there will be better voice control of entertainment systems. Either a direct echo/harmony integration, or a better echo/fire TV integration or something. But for right now this is very cool for the simple stuff, like “turn on Disney” and Clunky but worth it for people like me for the granular controls.

Most voice remotes right now require you to hold down the speaker button while you’re talking, which is exactly what I can’t do. This way is totally hands-free. :sunglasses:

p.s. I set up a room in the SmartThings mobile app called “entertainment center” and I put all of the virtual buttons into that. So that gets them out of the way but still easy to find.

@JDRoberts Thank you infinite times, for this. It was very easy to set up with the momentary button and it works flawless. ST should have some sort of “ST coins” that are awarded to people in the community with posts like this, which you can then use for their store or something.
Since I don’t have your physical limitations, the pause, rewind, forward, volume and off commands are not convenient for my household, but the ON commands just rock. Even still, just to be nerdy, I set my OFF command in an Alexa group where I say “Alexa, turn on Shutdown Procedure”. Sounds cool, but it would be more awesome if it was “Activate”, instead of “turn on”. :pensive:

Thank you again!

1 Like

Thanks so much!

I’m guessing “Turn on Mute”, or “Turn on Play”, etc are the commands that you’re using. Amazon needs to allow you to say anything and then execute based on rules. IF “Mute TV” then send mute command to Harmony.