HomeBridge icon 246x246Setup Homebridge to start via systemd to automatically restart Homebridge after crashes. After successfully installing Homebridge on Raspberry Pi, it often happens that Homebridge stops running and you have to manually press plugin auto repair in the Homebridge app and reboot the Homebridge service. By Setting up Homebridge to start via systemd, there is no need of manually reboot Homebridge or make any plugin auto repair via the iOS Homebridge app. The systemd method is the preferred ones because it will restart if an error occurs.

Homebridge automatic restart on boot up via systemd

Homebridge automatic restart on boot up via systemd

iOS Homebridge app is an ease of use for connecting non-certified HomeKit devices to HomeKit.

Homebridge für RaspberryPi
Homebridge für RaspberryPi
Developer: Niklas von Weihe
Price: 5,49 €

Raspberry Pi: How to set up Homebridge on Bootup via systemd

  1. Open Terminal SSH.
  2. sudo nano /etc/default/homebridge and paste this gist
  3. sudo nano /etc/systemd/system/homebridge.service and paste this gist
    1. Maybe you need to remove local from:  ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS  because your Homebridge is installed in /usr/bin/
  4. Create a user to run service: sudo useradd --system homebridge
  5. Type sudo mkdir /var/homebridge
  6. Type sudo cp /root/.homebridge/config.json /var/homebridge/
    1. This copies your current user’s config. This assumes you have already added accessories etc.
    2. Depending where the directory is you need to type: sudo cp ~/.homebridge/config.json /var/homebridge/
  7. Type sudo cp -r /root/.homebridge/persist /var/homebridge
    1. Depending where the directory is you need to type: sudo cp -r ~/.homebridge/persist /var/homebridge
  8. Type sudo chmod -R 0777 /var/homebridge
  9. Type sudo systemctl daemon-reload
  10. Type sudo systemctl enable homebridge
  11. Type sudo systemctl start homebridge
  12. Type systemctl status homebridge to check the status of the service.
  13. Type sudo reboot

Notes: 

  • Systems can also be activated in the iOS Homebridge app via. However, it looks like this way is not as good as activating systemd via ssh shell.
  • I successfully tested systemd on a Raspberry Pi Model 3 B+ and a Raspberry Pi 3 Model B.

Setup Homebridge to start on bootup via systemd to tackle Homebridge crashes and instability. These issues can be fixed by activating systemd via SSH shell commands. This option does not fix the rude cause, but keeps Homebridge automatically restarting and working after crashes.

Stay tuned! 😉

About 

Hi there,

my name is Gee Are, blogger and analyst. Blogging is my Passion! I’m the founder and owner of the two blogs called pabst.socialmedia and miapple.me - Tech.Blog.

My work experience as a blogger and analysist (Internet Intelligence, SEO and social media) is the basis of the services of pabst.socialmedia.

Find more about me.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.