Backup and Restore - Anthony-Chan/homebridge GitHub Wiki

Important Note

NOTE: This document was created from an empirical test of my setup. I do not have a complete understanding of the internals of Homebridge. The instructions below apply to and have been tested on a Raspberry Pi. The information on the persist folder and config.json should be relevant. The specifics of my procedures probably won't apply if you're using something else. You have been warned.

Now on to the good stuff.

Backing up

The configuration and identity information for your setup in these two locations.

  • ~/.homebridge/config.json (Configuration file. You had to create this to make your system work.)
  • ~/.homebridge/persist (Directory. You need the whole thing and it's contents.)

If you are using init.d, the startup config is stored in /etc/init.d/homebridge. If you're using systemd instead, you're on your own. I tried using that and couldn't figure it out so I just defaulted back to systemd.

Getting the files

Using FileZilla (or your favorite sftp client), connect to your Raspberry Pi by sftp. Upload the config.json, persist directory, and (if applicable) init.d.

Restoring

  • Setup your new Raspberry Pi. I set mine up with the same IP address through my router for convenience sake. I do not think, but i do not know if this is necessary.
  • Follow the instructions on setting up HomeBridge on a Raspberry Pi and stop at running HomeBridge on bootup.
  • Run HomeBridge manually from the command line. This will cause the ~/.homebridge directory to be created. It is not there until after first run.
  • Install all of your plugins. I think the order of this step and the previous step are unimportant. Either order should work.
  • Connect to your Raspberry Pi with sFTP.
  • Put the config.json and persist folders back in the same location.
  • If you are uploading the init.d script, you cannot directly upload it into the init.d folder. You'll need to upload it somewhere not restricted. I (think) I uploaded it to /etc.
  • sudo mv /etc/homebridge /etc/init.d
  • Run the init.d setup commands.
  • sudo chmod 755 /etc/init.d/homebridge
  • sudo update-rc.d homebridge defaults

That should be it. I didn't have to reconfigure anything in HomeKit and all of my devices were present after the upgrade!