Harmony Hub Best Practice

Hi,
When using harmony hub with hass is best practice to configure activities in hass rather than the hub? Atm, I’m adding activities to the hub but am wondering if that makes long term sense…

Regards,
Dave

I use activities in the hub.

I tried implementing dropdowns to change activities, the whole 9. In the end I went with the following configs:

activities in the hub.

template switches for each activity in HA. (all other options were a pain in the ass and randomly induced 30+ second lag to the hub)

Here is an example switch template that I use for activites:

        # TV HARMONY ACTIVITY
        tv:
          value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'TV') }}"
          turn_on:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'TV'
          turn_off:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'PowerOff'

The beauty of switch templates is that it doesn’t send ‘off commands’ when switching activites. This works well with harmony because harmony will auto turn off the current activity. That’s whats causes the random 30+ second lag. It’s also why input booleans don’t work without a ton of logic and why the input select is a pain in the ass to code in yaml. You have to have all these safety measures to ensure home assistant doesn’t send an ‘off’ before turning the next activity on.

Template switches solves that issue because it only issues the command of the switch.

EDIT: Just to let you know. I tried using the input_select first, didn’t like the control. Tried implementing input_booleans with yaml, caused all sorts of problems when all logic paths were covered. Tried re-implementing the input_boolean method using appdaemon to give better logic. That also caused issues for the hub (sending too many commands, causing lag). Ended up settling with template_switches. No lag, no issues, been using them for ~3 months at the moment.

2 Likes

Thanks for that. Very useful to know :slight_smile:

@petro do you have a startup sequence for your ATV in your hub config you’d be willing to share?
I’m using the Bluetooth apple tv device in harmony and am finding that I can’t consistently return the cursor to the home position from anywhere in the ATV interface. I’m wondering if this is because I’m using Bluetooth control rather than IR…

Regards
Dave

I don’t have much configured for harmony’s startup:

remote: 
  - platform: harmony
    name: living_room
    host: !secret remote_host

I’m not familiar with the ATV acronym. What does that refer to?

By ATV I mean apple tv. Sorry about that. And, the startup sequence I was referring to was the activity start sequence in the hub for returning the cursor to the home positron from anywhere in apple tv. I’m having trouble with that…inconsistent and unreliable.

Ah, I can’t help with that. I had an apple TV for a while but I never ended up using it because of various issues. Ended up using my PlayStation to stream. Sorry!

    # TV HARMONY ACTIVITY
    tv:
      value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'TV') }}"
      turn_on:
        service: remote.turn_on
        data:
          entity_id: remote.living_room
          activity: 'TV'
      turn_off:
        service: remote.turn_on
        data:
          entity_id: remote.living_room
          activity: 'PowerOff'

what is remote.living_room? is that the name of the harmony hub?

That’s the name of my harmony hub.

Check out this post, It has more of the pieces to the puzzle:

Hi Petro,

What file are you adding this switch configuration to?

  • Would it be possible to add it as a switch and then hide it from the HA home page?

I’m struggling to get my harmony to work in HA. I want to trigger certain Harmony based activities via MQTT.

thanks
T.

That should be inside configuration.yaml and it should be in the switch section.

Yes, this depends on the UI you are using though. Are you using the legacy interface or lovelace?

Harmony should just work and should be auto-detected. Are you at least that far in the configuration process?

Thanks Petro.

I thought this was going in to the configuration.yaml but having burned a few hours last night I wanted to be sure :slight_smile:

I wanted to hide the element from the hass.io overview page. I’m sure this will be possible, now I understand this is configured like a normal HA switch element.

  • Yes I think my harmony is working. It was broken with the latest update but since the latest update it seems to autodetect and I can see the right activity names in the generated harmoney-config.yaml (That might be the wrong file name… I’m not at my machine right now)

I think you’ve given me the direction I needed to get this working.

To hide things from the legacy ui, check out options for the customize section (which is inside the homeassistant section):

This will have options to hide it from the interface.

Thanks Petro,

I have now got it working!

For anyone else finding this thread who might need some pointers:
you need to also add an entity under Haromy which you then reference when you create the template switch. Otherwise it won’t work. This wasn’t clear to me when i started and required a bit more reading to work out. The other link above which Petro pointed at is a helpful thread worth reading.

Mine now looks like this:

  • platform: template
    switches:
    plex:
    value_template: “{{ is_state_attr(‘remote.Sittingroom_2’, ‘current_activity’, ‘Plex’) }}”
    turn_on:
    service: remote.turn_on
    data:
    entity_id: remote.Sittingroom_2
    activity: ‘Plex’
    turn_off:
    service: remote.turn_on
    data:
    entity_id: remote.Sittingroom_2
    activity: ‘PowerOff’

remote:

  • platform: harmony
    name: Sittingroom
    host: 10.168.254.77
    port: 8222
    entities:
    • switch.plex