I have mine setup using scripts, but it could be possible to use the same entity in a switch as well. It just looks like you are missing some info from your remote.turn_on command. You will need to use the codes in the harmony_living_room_conf file to choose the activity for the remote.turn_on data section.
Use the scripts above as templates for each of you activities. There should be one script for each activity, including power off. Then, load all the files in your HASS configuration files. In the web GUI, you should see a dropdown box in the Remotes section. You select an activity, it fires that activity. It’s also nice in that it updates shortly after you use the remote to switch activities too.
I do it similar as jeremy but instead of running scripts I directly use the commands. Don’t know whether this makes a difference though…
Just change the commands and names off your devices accordingly.
Enjoy your Harmony remote I don’t want to miss it
Thanks! This one helped me a lot. It’s working like a charm
Do you think it’s possible to skip the “current_activity” sensor and let the input_select display the current activity, instead of reverting back to “Select Input”?
The method that @jeremyowens posted eariler in this thread actually accomplishes what you are hoping to achieve.
However, for the purposes of teaching myself (as I’m quite new to HA), I wanted to have that same result but using @derdude1893’s method of directly using commands instead of using scripts. Here is what I have.
In my configuration.yaml,
input_select:
harmony:
name: Harmony
options:
- PowerOff
- Watch Cable TV
- Play Xbox One
- Watch a Blu-ray
- Give me Chromecast!
- Watch PC
icon: mdi:monitor
And in my automations.yaml,
- alias: Set Harmony activity using input_select
hide_entity: True
trigger:
platform: state
entity_id: input_select.harmony
action:
service: remote.turn_on
entity_id: remote.harmony_hub
data_template:
activity: >
{% if is_state("input_select.harmony", "Watch Cable TV") %}
17794266
{% elif is_state("input_select.harmony", "Play Xbox One") %}
17949443
{% elif is_state("input_select.harmony", "Watch a Blu-ray") %}
17718609
{% elif is_state("input_select.harmony", "Give me Chromecast!") %}
17718610
{% elif is_state("input_select.harmony", "Watch PC") %}
17759190
{% else %}
-1
{% endif %}
# This next automation is to update the input_select when the Harmony's
# activity was changed from somewhere else, e.g. using its physical remote.
- alias: Update Harmony input_select
hide_entity: True
trigger:
platform: state
entity_id: remote.harmony_hub
action:
service: input_select.select_option
data_template:
entity_id: input_select.harmony
option: "{{ states.remote.harmony_hub.attributes.current_activity }}"
I hope that helps. That took me way longer to figure out than I expected.
@RiseUp Thanks for your info, it really helped me set up my Harmony with HA.
One thing I’m struggling with now is how to turn the item off. For example, I can turn my lights on no problem with the Harmony dropdown that appears in the UI, but I just can’t figure out how to turn the lights off from the UI. I tried adding an action | service: remote.turn_off tied to a “Lights Off” item in the dropdown but that didn’t work.
How are you turning your lights on? Do you have a “Lights On” activity programmed in your Harmony Hub? If so, do you also have a separate “Lights Off” activity programmed, as well?
Thanks for the reply @RiseUp. My lights are controlled from the Harmony remote itself with a dedicated hard button.
You’re response leads me to believe that I need to create an actual “lights off” activity for my Harmony and then call that activity for the lights off. I was thinking this would work as a toggle, but I guess that’s not the case?
I have the emulated hue component configured and this exports lights.
In the harmony hub you can add the emulated hue bridge.
This allows you to export groups of lights in home assistant and map that to one of the buttons on your harmony hub.
I have a group of 3 lights in the living room as well as the hall.
When i click the button on my remote this turns on the lights in home assistant.
As far as I know, Home Assistant can only tell the Harmony Hub to fire off a command that exists in the harmony.conf file. While I, too, have lights mapped to hard buttons on the Harmony Elite remote, those commands do not appear in that .conf file.
Can’t you use HA to control your lights directly and avoid having to figure out a way to go through the Harmony?