Getting My Logitech Harmony Hub to Work With HomeKit After Logitech’s Firmware Changes

I got a Raspberry Pi last year just to integrate some of my less-than-smart devices with HomeKit, so I could control them via Siri. Late last year I decided to get a Logitech Harmony Hub to be able to control my TV, receiver, and Apple TV with Siri but Logitech decided to change-up their plans, shutting down their local API which integrated with Homebridge. They backtracked on their plans after their users voiced their outrage and new firmware dropped a few weeks ago. I had to make some changes but I finally got my Harmony Hub working with Siri once again. Here’s what I had to do…

Prerequisites

You must have Hub Software version 4.15.250 or later.

Go into the Harmony app and click on Menu → Harmony Setup → Add/Edit Devices & Activities → Remote & Hub, and then enable XMPP.

This will be a continuation of my configuration detailed in this post.

Updating the Raspberry Pi

Since I haven’t updated my RPi in many months, I chose to do this at this time. Oh, and set some time aside for this part — it took me about an hour.

Log into your Raspberry Pi via Terminal, e.g. ssh pi@192.168.x.x.

Type in sudo apt-get update and press Enter.

Then type in sudo apt-get upgrade and press Enter.

The next one is sudo apt-get dist-upgrade.

A little cleanup comes next with sudo apt-get clean.

Since I haven’t update the Raspberry Pi config app since last year, I decided to do so now: sudo raspi-config, scroll to 8 Update and press Enter. Exit the app it’s updated.

Restart your Raspberry Pi with sudo reboot.

Configuring Logitech Harmony Hub with Homebridge

I used to use the homebridge-harmony plugin but since it hasn’t been updated, I had to go look for an alternative. After two days of testing, it appears that the freshly updated homebridge-harmonyhub-plugin works as advertised, so I went with it.

Log into your Raspberry Pi again, via ssh: ssh pi@192.168.x.x.

Now it’s time to update all of our npm packages with npm outdated — this took around 20-30 minutes to complete.

Stop Homebridge: sudo systemctl stop homebridge.

The next step is to get rid of the old plugin: npm uninstall -g homebridge-harmonyhub.

We’ll need to delete the Homebridge cache, since it messes with our setup. Type cd /var/homebridge/accessories and then ls -la. You should see one file named cachedAccessories. If it’s there, we need to delete it: sudo rm cachedAccessories.

The next step involves installing the new plugin: npm -g install homebridge-harmonyhub-plugin.

My old config.json looked more or less 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": "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"
}
]
}

We need to edit that last part and change it so that the new plugin can understand it: sudo nano /var/homebridge/config.json.

Navigate to the end of the file and find "name": "Harmony Hub". Replace it with "name": "homebridge-harmonyhub-plugin". The result should look like this:
{
"platform": "HarmonyHub",
"name": "homebridge-harmonyhub-plugin"
}

Press ^X (Ctrl + X) to save and close the file, then press y, and confirm with the Enter key.

Assuming there are no errors on the config.json file, you should be able to start Homebridge now. Type in sudo systemctl daemon-reload, followed by sudo systemctl start homebridge, both confirmed with the Enter key.

You can check Homebridge’s logs in realtime with the following command: journalctl -f -u homebridge. You can exit by pressing ^C. After 30-60 seconds you should see something similar to the following, confirming that your Harmony Hub Activities have been recognised and added to HomeKit:
Mar 05 09:50:27 HomePi homebridge[220]: [2019-3-5 09:50:27] [homebridge-harmonyhub-plugin] {HarmonyHub} Found <1> hubs
Mar 05 09:50:27 HomePi homebridge[220]: [2019-3-5 09:50:27] [homebridge-harmonyhub-plugin] {HarmonyHub} <2d13738c-dcd6-483d-a7b5-6b8035de9e50> <Harmony Hub>
Mar 05 09:50:33 HomePi homebridge[220]: [2019-3-5 09:50:33] [homebridge-harmonyhub-plugin] {HarmonyHub} create new client for <Harmony Hub>
Mar 05 09:50:33 HomePi homebridge[220]: [2019-3-5 09:50:33] [homebridge-harmonyhub-plugin] {HarmonyHub} Found <2> activities: <TV, Music>

If you get some sort of error on launching Homebridge, try to validate your config.json file with a JSON validator, such as this one.

Since I got everything working once again, I went into the Automation part of HomeKit and added a few things, such as turning off select lights when I turn on the TV, and turning them back on once I’m done watching. I do wish the automation part was a bit more robust though since ideally, I’d like to first dim the lights for 10 minutes or so, and then turn them off. Keeping my fingers crossed for WWDC 2019 this year.