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

A picture says a thousand words… Did I quote it correctly?

Hi

I am not a programmer nor do i have a logical mind :grinning:I am reading these 144 posts and by the time I am ready to do anything I am totally confused hence not a logical minded.Just wondering if anyone has step by step instruction for “Alex turn on the TV” and Alexa Turn off the TV?

I have set up a virtual stimutlated switch and able to say “Alexa turn on the TV” provided the virtual switch is on the Off state.

Is it necessary to create a separate room?

Thanks

There is a separate FAQ for using the harmony trigger smart app without using IFTTT. It should answer your questions.

No need for Rooms, though personally I created one (formerly known as Groups) called Virtual Devices to store all my non-physical devices in just to keep things tidy. As far as step by step instructions @JDRoberts initial posts is pretty much it, but assuming you’d like to take IFTTT out of the equation check out @smart posts around 139 where he shows screenshots of the Logitech Harmony Trigger Smart APP. As @JDRoberts mentions around post 134, its hard to provide step by step instructions without knowing your exact setup. IE if the TV/Cable is all Harmony Controls something like “Activity Off” can probably be used where if you have an Activity that plays Sonos then you might not want “Alexa, Turn off the TV” to kill Sonos…

Assuming a simplest scenario, my recommendation would be to

  1. Create a SmartThings virtual momentary contact switch called “Cable” (Or perhaps Satellite basically whatever you use for service)
  2. Create a SmartThings virtual switch (on/off binary) called “TV”
  3. Authorize SmartThings “Cable” and “TV” switches to Alexa and Harmony
  4. Discovery devices in Alexa and Harmony
  5. Create Harmony activity called “Watch TV” whose start sequence turns on TV, turn on Cable Box, and turns on SmartThings switch “TV”. End Sequence should turn off tv, turn off cable box (if desired)
  6. Configure SmartThings “Cable” contact switch to run Harmony “Watch TV” activity when turned on via trigger SmartApp
  7. Configure SmartThings “TV” switch to run Harmony “Activity Off” activity when turned off.

Scenarios:

Alexa turned TV on but Harmony Remote turned it off.
Result:
SmartThings “TV” switch is still turned on. However that really doesn’t matter. Harmony knows the TV is off. If you were to say “Alexa turn off the TV”. The Harmony off activity would re-fire, doing nothing. Further when you’re ready to watch TV again regardless of if you use Alexa or Harmony Remote/App, Harmony will send the ON state to the switch which will do nothing. The only real purpose of the “TV” binary switch is to allow you to use natural language such as “Alexa, turn off the tv” vs the more programeresque “Alexa turn on Exit Routine”.

Harmony remote turned TV on, Alexa turns it off
Result:
Harmony turns your TV, Cable, and sends ON command to SmartThings binary switch called “TV”. Alexa turns that switch to Off which uses Harmony Trigger SmartApp to start Harmony Off Activity which turns TV, Cable off.

TV Manually turned off via power button, Alexa turns it on.
Will work. This is the advantage of using the momentary contact button for the “Cable” Switch. It doesn’t matter if SmartThings wasn’t told the TV was turned off its going to treat it like a garage door opener and when turned on (presed) call the Harmony “Watch TV” activity which will turn on the TV, Cable, and SmartThings “TV” switch which subsequently allows a “Alexa, turn off the TV” command.

TV manually turned on via power button, Alexa turns it off
Result:
Won’t work. This is the only real way you can get out of synch as you took Harmony out of the equation. IE turning the TV using its power button and then saying “Alexa, turn off the TV” wouldn’t work. That’s because Harmony was never used to set the SmartThings switch to “ON”. If this is a common scenario then you’d want to think about setting up an “Exit Routine” momentary contact switch. However Alexa would need to activate it via the counter-intuitive “Turn on” phrasing.

Hope that helps break it down. If you have any specific questions about your particular setup, feel free to message and I’ll see if I can help ya out.

1 Like

I used all momentary buttons, but that is close to what I did . Tivo Button, surround button, Movie button, Netflix button, Amazon Button and then a TV button. TV button is set to Harmony " end activity" activity, so regardless of what we were watching, “Turn Off TV” shuts everything down . I Put all the virtual buttons on a new room " entertainment center"
Only problem I ran into was Harmony app kept " forgetting" my channels when setting up activities for watching individual channels.
We will have to verify the WAF when she gets home and I just ask Alexa to “turn on channel 5”

1 Like

Did you set up parental guidance? :wink:

Appreciate the write up…

Can I use the same simulated switch created to “Turn TV on” also to “Turn TV off”,If yes how?.I am also using IFTTT

Thanks

Oh cool I didn’t think SmartThings would fire a momentary when given the off command, but looks like it does. So yeah that works just as well.

AFAIK , no, that is why I have separate momentary switches to turn on each Harmony activity. Then one momentary switch called TV that is linked to stop activity . So for instance I say " turn on Tivo" " Turn on channel 7 " or " Turn on movie" , then Turn off TV . So it doesn’t matter which activity was active " turn off TV " ends it.

You can but it would be much more likely to get out of synch and thus not work if you used something other than Alexa/SmartThings to manage your TV. A state diagram (yes another logic term :stuck_out_tongue: ) might help clarify it.

  1. Everything is off
    Alexa State: Off
    SmartThings TV Switch: Off
    Harmony Watch TV Activity: Off

  2. You sit down to watch TV and hit the activity button on your Harmony remote.
    Alexa: Off
    SmartThings TV Switch: Off
    Harmony Watch TV Activity: On

  3. You’re done watching tv so you say “Alexa, turn off TV”:
    Alexa: Sends Off to Smart Things TV Switch:
    SmartThings TV Switch: Since already off, SmartThings does nothing
    Harmony Watch TV Activity: Still On.

So as you can see if you use a single “Thing” (In this case a simulated on/off switch called TV) to both Start and End a Harmony Activity (Can be done using IFTTT) it has to be the only thing used to start/stop the Harmony activity. By having two “Things” (a momentary contact button called “Watch Cable” and one called “TV”). You can avoid the synchronization issue, and use intuitive on/off language. It just means you can’t tie two activities to the single “Thing”.

If you aren’t worried about the synchronization issue then steps to accomplish what you’re asking is

Using IFTTT:

  1. Create Simluated Switch in SmartThings called “TV”
  2. Authorize Switch in Echo, IFTTT
  3. Discover Devices
  4. Create “Watch TV” activity in harmony turning on TV and cable.
  5. Setup IFTTT recipe for If SmartThings switch called “TV” is turned on begin Harmony Activity “Watch TV”
  6. Setup IFTTT recipe for If SmartThings switch called “TV” is turned off end Harmony Activity
  7. Tape over power buttons on remotes :wink:

Without using IFTTT:

  1. Created Simulated Switch in SmartThings called “TV”
  2. Authorize switch in Echo
  3. Discover Devices
  4. Create “Watch TV” activity in harmony turning on TV and cable.
  5. Setup Logitech Harmony Trigger SmartApp in Marketplace → SmartApps → More. Configure to start “Watch TV” activity if “TV” switch is turned on. Name “Turn TV On”
  6. Setup Logitech Harmony Trigger SmartApp in Marketplace → SmartApps → More. Configure to start “Activity Off”
    activity if “TV” switch is turned off. Name “Turn TV Off”
  7. Tape over power buttons on remotes :wink:

It’s not that hard to keep in sync. I just set it up tonight.

  1. Create one momentary contact tile for each activity.
  2. Create a virtual switch called “TV” or whatever your preference is.
  3. Go into each activity in the Harmony app and set the before process to turn the switch in step 2 on at the start of an activity and the after process to turn that same switch off.
  4. Set up a different instance of the Logitech Harmony Trigger SmartApp for each activity, tied to “Switch turned on” and linked to the appropriate momentary contact tile from step one.
  5. Create another instance of the Logitech Harmony Trigger SmartApp for “Activity Off” and tie it to “Switch turned off” for the “TV” switch.
  6. Press the momentary contact tiles to turn on your activities, triggered via whatever means you like, Echo, a routine, just tapping the tile, etc.
  7. When the activity fires, Harmony will turn on the “TV” switch.
  8. When you want to shut everything down, turn the “TV” switch off, again via whatever means you like.

No matter which way you turn on OR OFF the activity, whether it’s via ST or just via Harmony app or remote, the ST switch “TV” will always reflect the on/off state of your AV system, and you’ll always be able to turn it off using the ST switch if you wish.

As always when dealing with Harmony remotes, you can’t use the individual device’s remotes if you wish to keep everything in sync, but that’s true whether you use ST or not. As long as everything goes through Harmony, it will stay in sync with ST.

2 Likes

TO AVOID LOOPS, USE A MOMENTARY BUTTON TILE TO TURN HARMONY ACTIVITIES ON IN ECHO. USE A BINARY SWITCH TO TURN HARMONY ACTIVITIES OFF IN ECHO.

If you want to use a “turn off the TV” command, use a binary virtual switch type (“simulated switch” is good) and one IFTTT recipe that does nothing but end the activity that powers things down.

Do not try to turn off a momentary switch. It won’t work the way you expect, and this is exactly what causes people to go into a loop as some have reported in this thread.

YOU CAN’T TURN OFF A DOORBELL BUTTON–IT DOES THAT AUTOMATICALLY AFTER EACH ON COMMAND.

A momentary switch is like a classical doorbell button. It is off most of the time and when you turn it on it turns on briefly and then turns itself off.

If you are using the “momentary button tile” Device type as your simulated momentary switch, it throws an on command and then an off command every time. If you ask echo to turn it on, it will actually turn on and then off as far as SmartThings is concerned.

So if you set up a recipe to act on the “off” you will have two recipes fire in quick succession firstly on, then the off. That messes everything up. :scream:

If you’re going to use a momentary switch with echo, use it only for on. But that’s what will keep things in synch for the next time use echo, even if you use the harmony button remote in between. Since the momentary always returns to the off position, it’s always ready for the next on.

This is why the simplest method described in post one of this thread uses the command “turn exit routine on” to get things to turn off. It’s because it’s using a momentary button.

YOU CAN TOGGLE A BINARY SWITCH ON OR OFF WITH ECHO, BUT IF YOU WANT TO USE A BINARY SWITCH TO CONTROL HARMONY ACTIVITIES YOU HAVE TO ALSO ADD IT TO THE HARMONY ACTIVITIES TO KEEP IT IN SYNCH WITH USE OF THE HANDHELD HARMONY REMOTE

If you’re going to use a binary switch, which is like a classic light switch toggle, you set up an IFTTT recipe that recognizes that switch being turned off, and then does an “end activity” in harmony. That’s what allows everything to power off the way you want when you say “turn the power off.”

If you want to, you can also set up a second IFTTT that will recognize the binary switch being turned on and use it to “turn the power on” that’s fine, it will work.

The reason this works, and the momentary switch does not work, is because the binary switch only issues the one state and then it stays in that state until something changes it back to the other state. So it stays on until something turns it off.

What makes the use of binary switch more complicated is that because the switch does not return itself to the off position, things can get out of sync so that SmartThings thinks it’s already on and you can’t turn it on again the next time.

The way around that is to add the binary switch, and only the binary switch, to every turn on activity that you have in Harmony so that it also gets turned on when you say “turn on ESPN TV” or “turn on the DVD” or “turn on Roku” or whatever. Since the binary switch is being turned on every time you use voice to turn anything on in Harmony, it’s available to turn Harmony off by voice.

This set up is much trickier than just using momentary buttons. But if you only use the momentary button tiles, then your echo command to power off your entertainment center will be “turn on the exit routine.” Because we never want to set up an IFTTT recipe that is triggered by turning off a momentary button tile, or it will also be triggered every time we turn on the momentary button tile. That particular kind of virtual switch issues an on immediately followed up by an off. Remember that doorbell button. You push it in, and then it automatically turns itself off again. So if you try to set up a recipe that just captures the off, it’s going to run every time you turn that switch on as well.

"Turn the TV Off" Will work great in echo, but only with the binary switch. And using the binary switch is a much more complicated set up.

So in my personal set up, I have a momentary button tile virtual switch for everything that I want to turn on in harmony whether it’s “turn on ESPN TV” or “turn on the DVD” it all works great. One IFTTT recipe for each momentary button tile virtual switch going on that starts the associated harmony activity. No IFTTT recipes at all for any momentary button tile virtual switch going off.

I also have one and only one “simulated switch” (which is a binary switch) which is used to turn everything off. I have only one IFTTT recipe for that switch. When that switch is turned off, it ends the Harmony activity that powers off my master device.

If I wanted to, I could also add one additional IFTTT recipe for the binary switch that would turn on its associated Harmony activity when that switch is turned on.

But I guarantee you if you set up a IFTTT recipe that is triggered by a momentary button tile going off and try to use that with echo, you’re going to get different results than you expect. :sunglasses:

1 Like

Ha, I did cause such a loop for myself earlier.

While setting up the single on/off switch method, I wondered if you could just use each activity switch to turn off the activity. I think if you made a trigger smart app for “activity off” and linked it to turning off a bunch of switches, it would happen if any one of those switches turned off. So if the activity switch was on/off, you could turn the switch on to start an activity and then turn it off to turn the system off. I went to test it, but forgot about them being momentary tiles, hence said loop.

Actually, while typing that out, I think I answered my own question. It wouldn’t work, because to keep things in sync between ST’s switch state and Harmony, you’d have to have the Harmony activity turn that switch on in the beginning of the activity and off at the end. Which might work fine if you started one activity, then shut the system down, but it wouldn’t work if you wanted to change from one activity to another, because Harmony would still flip that switch off as part of ending that activity and then the associated Smart App would initiate an off to the whole system, which would shut it down instead of switching activities.

So, momentary button tiles it is.

1 Like

I just sent this into Support, but checking here in case anyone has a suggestion and since support is already a day or two “late” on responding to a separate emailed issue. Thanks!

I’ve added a SmartApp via a ST template called Logitech Harmony (Connect). Unfortunately I did this BEFORE adding the Harmony Hub as a Thing and I now appears stuck in a bug.

When I click on Logitech Harmony (Connect) underneath Marketplace / My Apps it does not do anything except to create an instance under Rooms / SmartApps. Unfortunately I clicked that apparently 6 times trying to get it to respond, because I now have 6 instances of Logitech Harmony (Connect) within Rooms / SmartApps. When I click an instance, I get the spinning circle for a second and that disappears. There is no way way to delete these. Help!

Support deleted these “lost children” for me…

1 Like

I am going with your simple scenario and deleted all the earlier integartion/activities and recreated it all I think I am am very close…need a little help with the virtual device types confirmation.

Cable/Satellite is Momentary Button Tile?

TV -Simulated Swtich?

Do I need IFTTT?

Yes cable momentary and TV simulated switch. However based on what @RLDreams said you should be able to use all momentary button since for whatever reason “Turn off” still seems to activate momentary buttons. In that case you wouldn’t need Harmony activities to manage any SmartThings things just need SmartThings to manage Harmony activities. You can use IFTTT or SmartThings Harmony trigger app. I’d use trigger app to decrease number of clouds you’re dependent on but both will work.

1 Like

Sorry I’m late here…did I miss an announcement or an update to the Logitech/ST integration

The way I have it with a Momentary button is I have 1 button dedicated just for the Off sequence. So it is " Turn on Tivo, " , “Turn on Movie” , " Turn on Netflix" , " Turn on Prime ( Alexa didn’t like turn on Amazon) “, “Turn on Channel 5 " .
Then the 1 button simply “TV” . So regardless of what activity was started " Turn off TV” ends it, by shutting off everything ( TV, Tivo, Surround, Blu-ray player) .
I honestly don’t know what would happen if I asked her to " turn on TV” , but it might be like dividing by 0 :milky_way:

If things are setup correctly using the simulated switch, should I be able to say, Alexa, turn on the TV, and then Alex, turn off the TV? As of now, I have momentary buttons to turn on the harmony activity using, Alexa, turn on the TV, and then another momentary button that powers everything off, but I cant say, Alexa, turn off the TV. I had to create another group on the echo called, Family Room TV. I have to say, Alexa turn off the family room TV, instead of, Alexa, Turn off the TV.