Trigger by attribute change (Logitech Harmony Remote - currentactivity)

Hello,

I’m trying to develop an automation that triggers a different scene when I change the activity on my Logitech Harmony remote. I’ve tried a couple of different methods but none of them seem to trigger the event:

Method #1

  • alias: Media Room Watch Television Scene
    trigger:
    platform: state
    entity_id: remote.media_room
    condition:
    condition: template
    value_template: ‘{{ trigger.to_state.attributes.current_activity == “Televison” }}’
    action:
    service: homeassistant.turn_on
    entity_id: scene.media_room_scene_1

** Method #2 **

  • platform: template
    sensors:
    media_room_activity:
    value_template: ‘{{ states.remote.media_room.attributes.current_activity }}’
    friendly_name: ‘Media Room Activity’

  • alias: Media Room Watch Television Scene
    trigger:
    platform: state
    entity_id: sensor.media_room_activity
    state: ‘Television’
    action:
    service: homeassistant.turn_on
    entity_id: scene.media_room_scene_1

** Method 3**

  • alias: Media Room Watch TV
    trigger:
    platform: template
    value_template: “{% if is_state(‘remote.media_room.attributes.current_activity’, ‘Televison’) %}true{% endif %}”
    action:
    service: homeassistant.turn_on
    entity_id: scene.media_room_scene_1

Any ideas?

Thanks,
Paul

I’ve achieved exactly the same effect but using emulated_hue to trigger the scene and then including that as part of the activity on the harmony…much simpler :slight_smile:

I use this automation to switch the ambilight ON or OFF when activity PLEX starts or ends.
sensor.harmony is a template sensor that I have in the frontend to check current activity. It’s not necessary, but I like to see it :smile:

harmony:
      friendly_name: 'Comedor'
      value_template: >
        {% if states.remote.comedor.attributes.current_activity == "PowerOff" %}
          OFF
        {% elif states.remote.comedor.attributes.current_activity == "Ver TV" %}
          TV
        {% elif states.remote.comedor.attributes.current_activity == "HTPC" %}
          PLEX
        {% elif states.remote.comedor.attributes.current_activity == "SATELITE" %}
          SATELITE
        {% elif states.remote.comedor.attributes.current_activity == "Radio" %}
          RADIO
        {% elif states.remote.comedor.attributes.current_activity == "Unknown" %}
          OFF
        {% elif states.remote.comedor.attributes.current_activity == "Spotify" %}
          SPOTIFY
        {% endif %}
alias: "Ambilight"
trigger:
  - platform: state
    entity_id: sensor.harmony
    to: 'PLEX'
  - platform: state
    entity_id: sensor.harmony
    from: 'PLEX'
action:
  - service_template: >
      {% if trigger.to_state.state == 'PLEX' %}
        switch.turn_on
      {% elif trigger.from_state.state == 'PLEX' %}
        switch.turn_off
      {% endif %}
    data:
      entity_id: switch.hyperion

That worked. Thank you.

So the method describe in this thread is working for me, however it is taking too long to trigger the scenes. I think the HA harmony component is polling the harmony hub on a set basis to determine the state.

It sounds like the emulated_hue method described by @Bobby_Nobble would be much faster because the harmony hub would trigger the scene immediately. Is there any other method out there to improve the time it takes to trigger the scenes? I’d like to avoid putting any logic into my harmony hub as the interface is so poor, but I will go down the emulated hue path if there is no alternative.

1 Like

I now have HA set up to use the multiple emulated_hue custom component which lets me set it so the Harmony hub only sees the ‘lights’ I want it too rather than everything I’ve set up for Alexa, makes life much easier in the Harmony app.

I added the emulated_hue component, and have the harmony remote triggering my different scenes when the remote activities change. It is very fast/responsive so I’m much happier with this approach. Only downside is the configuration defining what scene is triggered is stored in harmony and not within the HA config, but I can live with that.