Assistance with customizing Logitech Harmony hub integration, move from dropdown to switches

I have a single Logitech Harmony hub connected to HA.

Using the native integration, the card has a pull down selector, with each activity described in the harmony_xxxxx.conf file.

image

type: entities
entities:
  - entity: select.media_ultimate_activities
    name: Activities
    icon: mdi:theater
title: Harmony Hub
state_color: true

I’d like to create a card that has individual buttons for each of the different Activities.

I’m having difficulty accomplishing this however.

Looking at the integration documentation, Logitech Harmony Hub - Home Assistant it seems simple to make a button that would be linked to the action “remote.turn_on” with data:activity:“The named activity”

However, in all my scripting “remote.turn_on” is not recognized as a valid action.

Am I missing something simple?

You don’t state where you are trying your scripting so…

Have you tried going to developer tools and actions and firstly checking you have “remote.turn_on” and “remote.turn_off” options and if so trying from there to run the actions?

remote.turn_on/off is the correct action and should work.

I ended up replacing the recently removed harmony activity switches with my own template switches to replicate the original switches and these all call the remote.turn_on/off action.

There should be no reason that a front end GUi button could not be used to achieve this action also.

Let us know if you can call the action via developer tools and if so maybe post up the yaml that you are trying that does not work.

1 Like

Thank you for pointing me in the right direction.

Yes, under developer tools, I can make a remote.turn_on/off and have it activate the Harmony remote.

I think my deficiency is understanding how to implement “actions” in general.

I was trying to do this all within a button/entity card.

I now recall I have a few other actions for other buttons that I’ve put into scripts. Then the button calls that script.

Is it possible to define an action and activate it all from within a button/entity card?

I was trying something like this, which was not working:

type: button
tap_action:
  action: perform-action
  target:
    entity_id: remote.media_ultimate
  data:
    activity: Watch PC

Something like this should be what you are looking for:

show_name: true
show_icon: true
type: button
tap_action:
  action: perform-action
  perform_action: remote.turn_on
  target:
    entity_id: remote.harmony_hub
  data:
    activity: "Sky on projector "
name: Example GUi button
1 Like

Thank you for that example. Looks like I neglected to add the necessary “perform_action” line.

Is there a way to keep a button highlighted based on if it was the last selected activity?

(ala the pull down selector on the native integration stays on the last selected activity).

EDIT:
I made an interactive glance card for my activities. I believe I have to use action scripts as the entities for the glance card because glance cards cannot display actions as the icons?

image

show_name: true
show_icon: true
show_state: false
type: glance
entities:
  - entity: script.harmony_watch_pc
    name: HTPC
    tap_action:
      action: call-service
      service: script.harmony_watch_pc
  - entity: script.harmony_watch_shield
    name: Shield
    tap_action:
      action: call-service
      service: script.harmony_watch_shield
  - entity: script.harmony_play_ps5
    name: PS5
    tap_action:
      action: call-service
      service: script.harmony_play_ps5
  - entity: script.harmony_watch_bluray
    name: Bluray
    tap_action:
      action: call-service
      service: script.harmony_watch_bluray
  - entity: script.harmony_play_ps3
    name: PS3
    tap_action:
      action: call-service
      service: script.harmony_play_ps3
  - entity: script.harmony_turn_off
    name: "Off"
    tap_action:
      action: call-service
      service: script.harmony_turn_off
state_color: true

Not sure about making the icons stay lit up, I am sure there may be some fancy way of doing it by maybe referencing the background select’s state but I opted for simple template switches that activate and show what activity is running, so switching on a different activity will force the current activities switch to off as only one activity can be present at once.

Glad you have something to work with now :+1:t2:

Would you mind showcasing what you’ve built with your template?

The harmony integration used to have switches as well as a select, however for some unknown reason the switches were removed. These switches were exposed to voice assistants to voice activate harmony activities. However most voice assistants can’t use the select entity so voice control no longer as easy to achieve.

The answer was simply to replace the original switches with template switches like this:


- platform: template
  switches:

    harmony_hub_cast_to_projector:
      friendly_name: cast on projector
      unique_id: harmony_hub_cast_to_projector
      value_template: "{{ is_state_attr('remote.harmony_hub', 'current_activity', 'Cast to Projector') }}"
      turn_on:
      - service: remote.turn_on
        target:
          entity_id: remote.harmony_hub
        data:
          activity: 'Cast to Projector'
      turn_off:
      - service: remote.turn_off
        target:
          entity_id: remote.harmony_hub
        data:
          activity: 'PowerOff'

Simply make a template switch for each activity as above. Then you can place those switches on your dashboard and display them as you please.

Only one switch can be on at a time so when you want to switch the current activity off simply switch the switch off, or if you want to change to a different activity simply turn the new activity switch on and you will note that the previous/current activity switch will automatically toggle off.