Adding my Logitech Harmony Hub (TV, AV receiver, and Apple TV) to HomeKit via Homebridge

I recently learned that I can add a Logitech Harmony Hub, Logitech Harmony Companion or Logitech Harmony Elite to HomeKit, with the help of Homebridge. This meant that I would be able to control my TV, AV receiver, and Apple TV with my voice my HomePod and/or Siri.

Ingredients

A Raspberry Pi (or other computer) running Homebridge.

A Logitech Harmony Hub, Harmony Companion, or Harmony Elite.

Configuration

Using a Raspberry Pi Zero W to Add a Camera and a Xiaomi Air Purifier 2 to HomeKit via Homebridge

My Raspberry Pi and Homebridge was configured a few months ago and I haven’t changed a single thing — everything still works as intended. All I had to do was install the a new plugin, edit the config file, and then restart the whole thing.

Logitech Harmony Companion

Every set of actions added to Logitech’s Harmony software will turn up as a single device in HomeKit. For example, my TV action does the following:

Turns on the TV and sets it to HDMI 1.

Turns on the AV receiver and sets its input to TV/CBL.

Turns on / wakes the Apple TV.

Homebridge Configuration

Log into your Raspberry Pi via SSH.

Install the appropriate plugin with the following command: npm install homebridge-harmonyhub -g.

If the command above throws an error, use this one: sudo chown -R $USER /usr/local && npm install homebridge-harmonyhub -g.

Edit /var/homebridge/config.json.

My original config looked like this:

{
"bridge": {
"name": "Homebridge",
"username": "XX:XX:XX:XX:XX:XX",
"port": 51826,
"pin": "031-45-154"
},
"description": "HomePi Homebridge.",
"accessories": [{
"accessory": "Air",
"apikey": "KEY",
"latitude": "xx.xxxxxx",
"longitude": "yy.yyyyyy",
"name": "DISTRICT"
},
{
"accessory": "Air",
"apikey": "KEY",
"latitude": "xx.xxxxxx",
"longitude": "yy.yyyyyy",
"name": "CITY"
}
],
"platforms": [{
"platform": "MiAirPurifierPlatform",
"deviceCfgs": [{
"type": "MiAirPurifier2",
"ip": "192.168.xxx.xxx",
"token": "xxx",
"airPurifierDisable": false,
"airPurifierName": "MiAirPurifier2",
"silentModeSwitchDisable": false,
"silentModeSwitchName": "MiAirPurifier2 Silent Mode Switch",
"temperatureDisable": false,
"temperatureName": "MiAirPurifier2 Temperature",
"humidityDisable": false,
"humidityName": "MiAirPurifier2 Humidity",
"buzzerSwitchDisable": true,
"buzzerSwitchName": "MiAirPurifier2 Buzzer Switch",
"ledBulbDisable": true,
"ledBulbName": "MiAirPurifier2 LED Switch",
"airQualityDisable": false,
"airQualityName": "MiAirPurifier2 AirQuality"
}]
},
{
"platform": "WeatherStation",
"name": "Weather DISTRICT",
"key": "xxx",
"location": "pws:XXXXXXXXX",
"interval": "4",
"forecast": "3days"
}
]
}

I had to add the following to it:

{
"platform": "HarmonyHub",
"name": "Harmony Hub"
}

This is my resulting config.json file:

{
"bridge": {
"name": "Homebridge",
"username": "XX:XX:XX:XX:XX:XX",
"port": 51826,
"pin": "031-45-154"
},
"description": "HomePi Homebridge.",
"accessories": [{
"accessory": "Air",
"apikey": "KEY",
"latitude": "xx.xxxxxx",
"longitude": "yy.yyyyyy",
"name": "DISTRICT"
},
{
"accessory": "Air",
"apikey": "KEY",
"latitude": "xx.xxxxxx",
"longitude": "yy.yyyyyy",
"name": "DISTRICT"
}
],
"platforms": [{
"platform": "MiAirPurifierPlatform",
"deviceCfgs": [{
"type": "MiAirPurifier2",
"ip": "192.168.xxx.xxx",
"token": "xxx",
"airPurifierDisable": false,
"airPurifierName": "MiAirPurifier2",
"silentModeSwitchDisable": false,
"silentModeSwitchName": "MiAirPurifier2 Silent Mode Switch",
"temperatureDisable": false,
"temperatureName": "MiAirPurifier2 Temperature",
"humidityDisable": false,
"humidityName": "MiAirPurifier2 Humidity",
"buzzerSwitchDisable": true,
"buzzerSwitchName": "MiAirPurifier2 Buzzer Switch",
"ledBulbDisable": true,
"ledBulbName": "MiAirPurifier2 LED Switch",
"airQualityDisable": false,
"airQualityName": "MiAirPurifier2 AirQuality"
}]
},
{
"platform": "WeatherStation",
"name": "Weather DISTRICT",
"key": "xxx",
"location": "pws:XXXXXXXXX",
"interval": "4",
"forecast": "3days"
},
{
"platform": "HarmonyHub",
"name": "Harmony Hub"
}
]
}

Naturally, I removed some personal information (API keys, etc.) from the file above — you will need to provide your own settings for those.

The next steps are:

Restart Homebridge: sudo systemctl restart homebridge.

Run sudo systemctl status homebridge systematically, until everything is loaded.

If everything is correct, Homebridge should report something similar to the following:

Nov 26 13:39:17 HomePi homebridge[1846]: [2018-11-26 13:39:17] Homebridge is running on port 51826.
Nov 26 13:39:20 HomePi homebridge[1846]: [2018-11-26 13:39:20] [Harmony Hub] Fetching Logitech Harmony activities...
Nov 26 13:39:22 HomePi homebridge[1846]: [2018-11-26 13:39:22] [Harmony Hub] Found activities:
Nov 26 13:39:22 HomePi homebridge[1846]: TV
Nov 26 13:39:22 HomePi homebridge[1846]: PowerOff

The Result

My Living Room now has a TV in it. Pressing that button either turns everything on — if the TV, AV receiver, and Apple TV are off — or off, if they’re on. If you add more “actions” to Logitech’s Harmony software, they will show up as different buttons, e.g. PlayStation, Xbox One, or Cable TV. Theoretically you could also create specific actions for specific cable TV channels — one for your morning news, which would switch the channel to the BBC, and another for your nightly binge, which would launch Sky Movies.

Since I also have a HomePod, I can now just say “Hey Siri, turn on the living room TV” or just “Hey Siri, turn on TV”, to turn my whole setup on.

Homebridge is definitely a great stepping-stone, until everything we use supports HomeKit!