Removing Homebridge From HomeKit and Re-Adding It to Another Home

I recently set up a new completely new Home in the Home app and needed to move all my stuff over from one to the other. This turned out harder than I had anticipated.

Remove Old Home First

The first thing to remember, is to first remove everything from your old Home, then remove the Home itself, and then create a new one, adding all the stuff one by one. If you don’t remove the old one first, Home will be confused about where it actually is (physically in the world) and automations using geofencing will not work correctly — mine thought it was still at the old address. I fixed it, but I don’t know how — I changed “Home” in Maps, I changed my billing address in Wallet, and tried a few other things. After a few hours it seemed to right itself, but I don’t know which change did the trick.

Re-Add Homebridge

The one thing that constantly refused to work was re-adding my Homebridge Raspberry Pi as a bridge to the new home. I had expanded it multiple times over the years, adding Logitech Harmony support, and various other things, but now I had simplified things, leaving only the Raspberry Pi camera and Xiaomi Air Purifier intact.

That meant I had to clean up my config.json file and remove all the older stuff. It currently looks like this…

{
"bridge": {
"name": "Homebridge",
"username": "xx:xx:xx:xx:xx:xx",
"port": 51826,
"pin": "031-45-154"
},
"description": "HomePi Homebridge.",
"platforms": [{
"platform": "MiAirPurifierPlatform",
"deviceCfgs": [{
"type": "MiAirPurifier2",
"ip": "192.168.1.xx",
"token": "token_code_goes_here",
"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"
}]
}
]
}

Unfortunately, Home would still not let me add the Homebridge to it, so I had to do the following:

Remove everything under /var/homebridge/accessories:

cd /var/homebridge/accessories

rm *

Remove everything under /var/homebridge/persist:

cd /var/homebridge/persist

rm *

Restart Homebridge: sudo systemctl restart homebridge.

Check everything is OK: journalctl -f -u homebridge.

That’s it! Just removing everything under the persist and accessories folders, which will get recreated automatically, allowed me to re-add Homebridge to Home.