Logitech Harmony Integration with @iandday's component

I had feedback loop issues on my RPi3 with the auto-correcting input_select and ended up going another route. Here’s what I have:

The majority of the code is the same, but rather than trying to correct the input_select anytime it changes, I instead directly display the current activity using a template sensor and have the input_select revert to Select Input after sending the start activity command to the harmony hub.

input_select:
  harmony:
    name: Harmony Control
    options:
### DO NOT REMOVE 'SELECT INPUT'
      - Select Input
      - Watch DirecTV
      - Watch Plex
      - Watch Netflix
      - Watch Hulu
      - Watch Prime Video
      - Watch Chromecast
      - Watch Smart TV
      - Power Off
    icon: mdi:monitor

sensor:
  - platform: template
    sensors:
      current_activity:
        friendly_name: 'Current Activity'
        value_template: '{{ states.remote.living_room.attributes.current_activity }}'

- alias: Harmony
  hide_entity: True
  trigger:
    platform: state
    entity_id: input_select.harmony
    from: 'Select Input'
  action:
    - service: remote.turn_on
      entity_id: remote.living_room
      data_template:
        activity: >
          {% if is_state("input_select.harmony", "Watch DirecTV") %}
            19594181
          {% elif is_state("input_select.harmony", "Watch Plex") %}
            19755764
          {% elif is_state("input_select.harmony", "Watch Netflix") %}
            23422788
          {% elif is_state("input_select.harmony", "Watch Hulu") %}
            20619552
          {% elif is_state("input_select.harmony", "Watch Prime Video") %}
            19752038
          {% elif is_state("input_select.harmony", "Watch Chromecast") %}
            19938341
          {% else %}
          {% endif %}
    - service: input_select.select_option
      entity_id: input_select.harmony
      data_template:
        option: "Select Input"

- alias: Harmony Off
  hide_entity: True
  trigger:
    platform: state
    entity_id: input_select.harmony
    to: 'Power Off'
  action:
    - service: remote.turn_off
      entity_id: remote.living_room
    - service: input_select.select_option
      entity_id: input_select.harmony
      data_template:
        option: "Select Input"
5 Likes