Hi all,
I previously had Homebridge with plugin named “homebridge-harmonyhub-plugin” successfully running with my Harmony Hub and Homekit / Home App. The whole setup took me 30 minutes at most. In the Home App each Harmony activity was represented as a switch, all working fine with minimal effort.
And then I thought it would be a great idea to try out Home Assistant 0.87.1 as a Docker container with Harmony Hub and HomeKit. Boy, was I wrong…
Using the whole day of tinkering and reading forum articles I was able to get it to accept the config files, automatically detect the Harmony Hub and setup HomeKit with switched from what exists in HA.
But! None of the Harmony Hub activities are executed properly so that the HH would send out the signals to the devices.
The solution for selecting the activites that I found in the forums seems very elegant, since it is firstly well understandable for someone with a programming background, and very concise, not repeating the same statements for each HH activity that should be used. Having said that, it does not seem to works, and also it does not seem to lend itself well for translating into HomeKit switches…
I would like to get it to work first using HA, and then build a solutin that works fine with HomeKit.
Firstly here are the activities from the harmony…conf file:
"Activities": {
"-1": "PowerOff",
"38320141": "Watch TV",
"38320146": "Listen to Vero 4K+",
"38320147": "Listen to IP Radio",
"38320148": "Listen to FM Radio",
"38320149": "Watch Vero 4K+",
"38320150": "Watch LibreELEC",
"38378853": "Watch PC",
"38379589": "Play PS4/BD",
"38379693": "Play PS3/BD",
"38379709": "Play Xbox/DVD",
"38382230": "Watch FireTV"
},
Secondly here are the relevant entities from the configuration file:
discovery:
enable:
- homekit
homekit:
# max. 100 accessories are supported per bridge by HomeKit
auto_start: false
name: "Home Assistant Bridge"
safe_mode: false
filter:
# include_domains:
# - climate
# - cover
# - light
# - switch
# - binary_sensor
# - alarm_control_panel
# - lock
exclude_domains:
- script
- automation
# - input_boolean
include_entities:
- demo.demo
# exclude_entities:
# entity_config:
# switch.somename:
# name: Stand Light
# type: outlet
remote:
- platform: harmony
name: "Harmony Hub Living Room"
input_select:
harmony_hub_living_room_activities:
name: "Harmony Hub Living Room Activities"
options:
- "PowerOff"
- "Watch TV"
- "Watch Vero 4K+"
- "Watch LibreELEC"
- "Watch FireTV"
- "Play PS4/BD"
- "Play PS3/BD"
- "Play Xbox/DVD"
- "Listen to Vero 4K+"
- "Listen to IP Radio"
- "Listen to FM Radio"
- "Watch PC"
initial: "PowerOff"
icon: mdi:monitor
And finally here are the automations form the automations config file:
- alias: 'Start HomeKit'
hide_entity: True
trigger:
- platform: homeassistant
event: start
action:
- delay: 00:02 # Waits 2 minutes
- service: homekit.start
- alias: Selected activity is sent via Harmony Hub Living Room
hide_entity: True
trigger:
platform: state
entity_id: input_select.harmony_hub_living_room_activities
action:
service: remote.turn_on
entity_id: remote.harmony_hub_living_room
data_template:
activity: '{{ states.input_select.harmony_hub_living_room_activities.state }}'
- alias: Reflect Harmony Hub Living Room activities in the currently selected field in input_select
hide_entity: True
trigger:
platform: state
entity_id: remote.harmony_hub_living_room
action:
service: input_select.select_option
data_template:
entity_id: input_select.harmony_hub_living_room_activities
option: "{{ states.remote.harmony_hub_living_room.attributes.current_activity }}"
Starting homekit is delayed for 2 minutes to ensure that all required entities are ready for export to HomeKit.
The Basic idea is to use exactly the names of the HH activities in an input_selection, and sending out the selected activity via the HH. If the HH has activity events from pressing one of the remotes (outside of HA), the current selection of the input_section field shall be updated accordingly. This code is very concise, short and elegant, no need for useless code repetitions as in countless other examples. There are people here that had this code already properly working for them.
Alas, I am out of luck. The input_selection is displayed and a selection triggers a service call. the However, HH is not sending out any commands over the air, and also any activities of HH made via the physical remotes are not reflected by updating the input_selection field.
Interestingly, calling the HH services directly -as shown in the attached screenshot- works fine.
It would be great if someone with a better understanding of HA can help out, what is missing here!