Harmony Hub Activity -> Home Assistant -> Homebridge

I’ve been hacking away at this for a while and I’m at a dead end. I use Homebridge for my HomeKit integration and I use to use the Harmony plugin for it, but it crashes a lot. It was good when it did work and I got use to having Switches in my HomeKit for my Harmony activities. Seems like a good option for integration.

I’ve been trying to create switches in Home Assistant for my Harmony Activities so I can then expose those to Homebridge. I’ve been able to get an input select to change activities on my Harmony, but I can’t get those setup as switches that I can setup for Homebridge.

Does anyone else have this kind of setup and is approach the best way to get Harmony into HomeKit? Any insights and help would be greatly appreciated!

1 Like

Trying to do something similar for the same reasons.

To get started, I mostly have an Input_Select working in the HASS UI using this post as a guide (mostly because one of my options isn’t working, but most are):

Next step, how to surface this in HomeKit… This post claims, “Homebridge doesn’t allow scripts to be mapped over for use with Siri” and suggest Input_Boolean, but doesn’t provide any details.

Frankly, I’m having problems finding documentation on things like Input_Select and Input_Boolean so I’m having to search for examples to try to get details (EDIT: Guess these are “components”, so when I searched the component list for “input” if found some documentation). Don’t know if Input_Selects or Automations can be mapped over by Homebridge, but that’s the search track I’m currently on.
FURTHER EDIT:
So of the types supported by the Homebridge add-on I’m leaning toward automation, input_boolean, media_player, remote, scene, or switch as possible tracks…

Don’t know if any of this provides you breadcrumbs to follow, but I’m searching for the same kind of solution if you find it!

Just an update, I decided to go back to the Homebridge Harmony plugin https://github.com/KraigM/homebridge-harmonyhub and I haven’t had any issues for the last 4 days. I’m running 0.3.0-alpha.2

Agreed, the alpha update has been much better. I have had a few crashes, but much fewer and it’s more manageable.

I use scripts within scenes, switches (turn on activates one script, turn off activates a different script) etc. and they run really well.

If you decide to try again and want any help I can share how I’ve set mine up.

@jono I’d love to see you configuration, I like the harmony hub homebridge plugin, but it’d be great to have more flexibility through Home Assistant

Sure. So I’m not so keen on just running Harmony activities, as sometimes something doesn’t trigger correctly (e.g. sometimes it won’t always switch to the correct HDMI port) and once a Harmony activity has been run you can’t activate it again (have to run another activity and then run the one you wanted originally again).

So what I do is send separate commands through the Harmony instead of the ‘proper’ activities.

So first I created scripts for individual commands

sony_tv_on:
  sequence:
  - service: remote.send_command
    data_template:
      command: PowerOn
      device: "39974893" # Sony TV
      entity_id: remote.harmony_hub_lounge

sony_tv_off:
  sequence:
  - service: remote.send_command
    data_template:
      command: PowerOff
      device: "39974893" # Sony TV
      entity_id: remote.harmony_hub_lounge

sony_tv_hdmi_1:
  sequence:
  - service: remote.send_command
    data_template:
      command: InputHdmi1
      device: "39974893" # Sony TV
      entity_id: remote.harmony_hub_lounge

sony_tv_hdmi_2:
  sequence:
  - service: remote.send_command
    data_template:
      command: InputHdmi2
      device: "39974893" # Sony TV
      entity_id: remote.harmony_hub_lounge


tv_channel_kids_harmony:
  sequence:
  - service: remote.send_command
    data_template:
      command: ["Return", "6", "0", "1"]
      device: "42617639" # Sky Q
      entity_id: remote.harmony_hub_lounge

tv_channel_bbc1_harmony:
  sequence:
  - service: remote.send_command
    data_template:
      command: ["Return", "1", "0", "1"]
      device: "42617639" # Sky Q
      entity_id: remote.harmony_hub_lounge

Then I combine these individual command scripts into sort of activities
tv_channel_kids:
  sequence:
  - service: script.turn_on
    entity_id: script.sony_tv_on
  - service: script.turn_on
    entity_id: script.sony_tv_hdmi_1
  - service: script.turn_on
    entity_id: script.tv_channel_kids_harmony
  - service: script.turn_on
    entity_id: script.sony_tv_hdmi_1

tv_channel_normal:
  sequence:
  - service: script.turn_on
    entity_id: script.sony_tv_on
  - service: script.turn_on
    entity_id: script.sony_tv_hdmi_1
  - service: script.turn_on
    entity_id: script.tv_channel_normal_harmony
  - service: script.turn_on
    entity_id: script.sony_tv_hdmi_1


all_media_off:
  alias: "Media devices off (Staggered)"
  sequence:
    - service: script.turn_on
      entity_id: script.xbox_pause
    - delay: 00:00:02
    - service: script.turn_on
      entity_id: script.apple_tv_home
    - delay: 00:00:01
    - service: script.turn_on
      entity_id: script.sky_backup_twice_harmony
    - delay: 00:00:01
    - service: script.turn_on
      entity_id: script.sky_q_power_toggle
    - delay: 00:00:01
    - service: script.turn_on
      entity_id: script.sony_tv_off



# Turn on Sky Q + Kids TV
telly_on:
  sequence:
  - service: script.turn_on
    entity_id: script.sky_q_power_toggle
  - service: script.turn_on
    entity_id: script.sony_tv_on
  - delay: 00:00:07
  - service: script.turn_on
    entity_id: script.tv_channel_kids_harmony
  - service: script.turn_on
    entity_id: script.sony_tv_hdmi_1


xbox:
  sequence:
  - service: script.turn_on
    entity_id: script.xbox_on
  - service: script.turn_on
    entity_id: script.sony_tv_on
  - service: script.turn_on
    entity_id: script.sony_tv_hdmi_3
  - service: remote.turn_on
    entity_id: remote.harmony_hub_lounge
    data:
      activity: "22855433"
  - service: script.turn_on
    entity_id: script.sony_tv_hdmi_3


apple_tv_plex:
  sequence:
  - service: script.turn_on
    entity_id: script.sony_tv_on
  - service: script.turn_on
    entity_id: script.sony_tv_hdmi_2
  - service: remote.turn_on
    entity_id: remote.harmony_hub_lounge
    data:
      activity: "22893099"
  - service: script.turn_on
    entity_id: script.sony_tv_hdmi_2


apple_tv_netflix:
  sequence:
  - service: script.turn_on
    entity_id: script.sony_tv_on
  - service: script.turn_on
    entity_id: script.sony_tv_hdmi_2
  - service: remote.turn_on
    entity_id: remote.harmony_hub_lounge
    data:
      activity: "25454025"
  - service: script.turn_on
    entity_id: script.sony_tv_hdmi_2

I also create some (what I call) manual switches that run different scripts when turned on and off
kids_tv_manual:
  value_template: "{{ is_state('switch.tv_manual', 'on') }}"
  turn_on:
    - service: script.turn_on
      entity_id: script.tv_channel_kids
  turn_off:
    - service: script.turn_on
      entity_id: script.sony_tv_off


plex_manual:
  value_template: "{{ is_state('switch.plex_manual', 'on') }}"
  turn_on:
    - service: script.turn_on
      entity_id: script.apple_tv_plex
  turn_off:
    - service: script.turn_on
      entity_id: script.apple_tv_plex_off


netflix_manual:
  value_template: "{{ is_state('switch.netflix_manual', 'on') }}"
  turn_on:
    - service: script.turn_on
      entity_id: script.apple_tv_netflix
  turn_off:
    - service: script.turn_on
      entity_id: script.netflix_off
1 Like