Having a tough time configuring Harmony

I’ve been trying to configure my Harmony Hub and but have been unsuccessful. I found this post that explains it well but I am not sure where to place the scripts suggested by @jeremyowens.

Do I simply place then in the configuration file?

my is set as

#HARMONY

  • platform: harmony
    name: Harmony Hub
    host: 192.168.1.21

but I rather use it with IFTTT and Google Home

I should of been more clear. I’ve been trying to start activities on the front end but have been unsuccessful.

  1. create a script.yaml
  2. on configuration.yaml. edit or add:
    script: !include script.yaml
  3. Add all your scripts on the script.yaml

Check this thread out for how to call activities.

If you look at the text above the files in the other post, it shows you the directory (relative to the configuration.yaml file) where I have mine placed. I have my configuration broken up into multiple files. If you don’t, then you should consider it as your installation grows. Here’s a guide on getting started:

In order to help you, here’s the rest of the files that I use (in order to make this work):

configuration.yaml: (only the parts that are necessary for this script)

automation old: !include automations_old.yaml
input_select: !include input_select.yaml
script: !include scripts.yaml

automations_old.yaml

- !include automations/automations_harmony_input_select.yaml
- !include automations/automations_harmony_update_current_status.yaml

input_select.yaml

harmony:
  name: "Living Room Harmony"
  options:
    - "Watch TV"
    - "Watch Apple TV"
    - "Watch a Blu-Ray"
    - "Play Nintendo"
    - "Play Xbox One"
    - "Use HDMI Cable"
    - "PowerOff"
  initial: "PowerOff"

scripts.yaml

harmony_living_room_watch_tv: !include scripts/scripts_harmony_living_room_watch_tv.yaml
harmony_living_room_watch_a_blu_ray: !include scripts/scripts_harmony_living_room_watch_a_blu_ray.yaml
harmony_living_room_watch_apple_tv: !include scripts/scripts_harmony_living_room_watch_apple_tv.yaml
harmony_living_room_play_nintendo: !include scripts/scripts_harmony_living_room_play_nintendo.yaml
harmony_living_room_play_xbox_one: !include scripts/scripts_harmony_living_room_play_xbox_one.yaml
harmony_living_room_use_hdmi_cable: !include scripts/scripts_harmony_living_room_use_hdmi_cable.yaml
harmony_living_room_poweroff: !include scripts/scripts_harmony_living_room_poweroff.yaml

I then have directories called “automations” and “scripts” where the files from the other post are placed. Here are 2 examples of what is in the scripts directory:

scripts/scripts_harmony_living_room_watch_tv.yaml

alias: "LR-Watch TV"
sequence:
  - service: remote.turn_on
    entity_id: remote.living_room_harmony
    data:
      activity: "987654321"

scripts/scripts_harmony_living_room_poweroff.yaml

alias: "LR-Power Off"
sequence:
  - service: remote.turn_off
    entity_id: remote.living_room_harmony

Hope this helps.

1 Like

@jeremyowens that helped tremendously and I now have the input select part working. What i can’t figure out is why the switch doesn’t. I have this

- platform: template
  switches:
tv:
  value_template: "{% if is_state('remote.living_room', 'on') %}on{% else %}off{% endif %}"
  turn_on:
    service: remote.turn_on
    entity_id: remote.living_room
  turn_off:
    service: remote.turn_off
    entity_id: remote.living_room

and it turns off fine but doesn’t turn on.

Because you haven’t told Harmony which activity to start. For that you need to add the data and the activity number as per above.

I did add that part as well but still doesn’t work.

I now have

  • platform: template
    switches:
    tv:
    value_template: “{% if is_state(‘remote.living_room’, ‘on’) %}on{% else %}off{% endif %}”
    turn_on:
    service: remote.turn_on
    entity_id: remote.living_room
    data:
    activity: “myactivitynumber”
    turn_off:
    service: remote.turn_off
    entity_id: remote.living_room

And you verified your activity number is correct? Also, it’s helpful if you post with the preformatted text button so we can properly see your spacing…like this

- platform: template
  switches:
    tv:
      value_template: "{% if is_state(‘remote.living_room’, ‘on’) %}on{% else %}off{% endif %}"
      turn_on:
        service: remote.turn_on
        entity_id: remote.living_room
        data:
          activity: xxxxxx
      turn_off:
        service: remote.turn_off
        entity_id: remote.living_room
1 Like

@Jer78 So after adding data: and activity:, it finally started working. I noticed that sometimes it takes a while for HA to discover my Harmony Hub so I decided to wait a while after editing the file and restarting, to try starting an activity. Works great now.

Thank you all very much for your help.

Awesome! Nice to hear you’re all up and running.

If you’re interested, here’s a little trick I do with the Harmony remote. Depending on the activity, I hide groups with things like media_players on the front-end. This way it just provides a contextual type interface. In my example below, I did create a template sensor to get the activity and also an input_select to select the activity (for simplicity I haven’t included them) Just thought I’d share…

  - alias: "Basement Media Center from Harmony Hub"
    initial_state: on
    trigger:
      - platform: state
        entity_id: sensor.basement_harmony_remote
        to: 'Media Center'
      - platform: homeassistant
        event: start
    condition:
      condition: or
      conditions:
        - condition: template
          value_template: '{{ is_state("input_select.basement_harmony", "Media Center") }}'
        - condition: template
          value_template: '{{ is_state("sensor.basement_harmony_remote", "Media Center") }}'
    action:
      - service: input_select.select_option
        entity_id: input_select.basement_harmony
        data:
          option: "Media Center"
      - service: group.set_visibility
        entity_id: group.basement_plex
        data:
          visible: False
      - service: group.set_visibility
        entity_id: group.basement_tv
        data:
          visible: True
      - service: group.set_visibility
        entity_id: group.spotify
        data:
          visible: False
      - service: group.set_visibility
        entity_id: group.basement_sonos
        data:
          visible: True
      - service: group.set_visibility
        entity_id: group.basement_fire_tv
        data:
          visible: False
      - service: group.set_visibility
        entity_id: group.basement_listen_to_music
        data:
          visible: False
4 Likes

You ought to consider adding that to the documentation. That’s a great idea!