Setup Homebridge to Start on Bootup

I’ve recently been playing with Homebridge on my Raspberry Pi. I’ve setup my Harmony Hub and my wireless power outlets to be controlled by Siri on my iPhone. Overall it has been pretty simple to setup but I did run into an issue trying to get Homebridge to start on bootup. Homebridge suggest 3 different methods

I decided to use systemd to start Homebridge on bootup. I prefered this method because it will restart if an error occurs. I followed the gist setup step by step but ran into some problems.

My main issues were:

  • The location of my homebridge binary. Step 2
  • Permissions were not correct and the service failed to load. Step 7
  • I needed the persist folder in /var/homebridge directory. Step 6

Here are the steps that worked for me:

  1. sudo nano /etc/default/homebridge and paste this gist
  2. sudo nano /etc/systemd/system/homebridge.service and paste this gist
    1. I had to remove local from:  ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS  because my homebridge installed in /usr/bin/
  3. Create a user to run service: sudo useradd --system homebridge
  4. sudo mkdir /var/homebridge
  5. sudo cp ~/.homebridge/config.json /var/homebridge/
    1. This copies your current user’s config. This assumes you have already added accessories etc.
  6. sudo cp -r ~/.homebridge/persist /var/homebridge
  7. sudo chmod -R 0777 /var/homebridge
  8. sudo systemctl daemon-reload
  9. sudo systemctl enable homebridge
  10. sudo systemctl start homebridge

Type systemctl status homebridge to check the status of the service.

Type journalctl -f -u homebridge to view the logs

If you are still having issues, try removing the User=homebridge from the homebridge.service file

Hopefully this helps anyone who is having trouble with Homebridge starting on boot on a Raspberry Pi. Please comment below if you have any questions.


Thanks for reading. Make sure you follow me on Twitter to stay up to date on the progress of my side projects T.LYWeather Extension, and Link Shortener Extension. If you are interested in the tech I use daily, check out my uses page.  

456 thoughts to “Setup Homebridge to Start on Bootup”

  1. These instructions were great. However, still no go.

    Firstly, you included ‘sudo’ up to step 8. Then stopped. This correct? Because I get a failure when I don’t include it.

    Now, when I do include it, I get this: ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: activating (auto-restart) (Result: exit-code) since Sat 2016-10-15 00:27:51 UTC; 5s ago
    Process: 3793 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)
    Main PID: 3793 (code=exited, status=203/EXEC)

    Oct 15 00:27:51 raspberrypi systemd[1]: Unit homebridge.service entered fail….
    Hint: Some lines were ellipsized, use -l to show in full.
    pi@raspberrypi:~ $
    ————————–
    This error is annoying me. I am pretty new to this, and have followed the steps here and on the other page where you linked from. No luck. Any ideas?

    1. Update: I realised the Exec Start included local, but mine doesn’t. Removed. New Error:
      ● homebridge.service – Node.js HomeKit Server
      Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
      Active: activating (auto-restart) (Result: exit-code) since Sat 2016-10-15 00:48:22 UTC; 5s ago
      Process: 4409 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
      Main PID: 4409 (code=exited, status=1/FAILURE)

  2. Really appreciate the time you’ve spent with these instructions… worked a charm for me…now have lifx bulbs and nest running thru homekit on a pi3 and I’ve learnt far more than I was expecting! Many thanks

  3. pi@smarthome:~ $ useradd –system homebridge
    Aufruf: useradd [Optionen] BENUTZERZUGANG
    useradd -D
    useradd -D [Optionen]

    Optionen:
    -b, –base-dir BASIS_VERZ Basisverzeichnis für das
    Home-Verzeichnis des neuen Benutzers
    -c, –comment KOMMENTAR KOMMENTAR für das GECOS-Feld des neuen
    Benutzers
    -d, –home-dir HOME_VERZ Home-Verzeichnis des neuen Benutzers
    -D, –defaults Anzeigen oder Speichern der modifizierten
    Standardkonfiguration für useradd
    -e, –expiredate ABL_DATUM Das Ablaufdatum des neuen Benutzerzugangs
    -f, –inactive INAKTIV Passwort nach Ablauf von INAKTIV deaktivieren
    -g, –gid GRUPPE Name oder ID der primären Gruppe des neuen
    Benutzerzugangs
    -G, –groups GRUPPEN Liste der zusätzlichen Gruppen für den
    neuen Benutzerzugang
    -h, –help Diese Hilfe anzeigen, sonst nichts
    -k, –skel SKEL_VERZ Ein alternatives skeleton-Verzeichnis
    (Vorlagenverzeichnis) verwenden
    -K, –key SCHLÜSSEL=WERT Die Vorgabewerte in /etc/login.defs
    überschreiben
    -l, –no-log-init Den Benutzer nicht zu den lastlog- und
    faillog-Datenbanken hinzufügen
    -m, –create-home Home-Verzeichnis des neuen Benutzers erstellen
    -M, –no-create-home Kein Home-Verzeichnis für den Benutzer
    erstellen
    -N, –no-user-group Keine Gruppe mit dem gleichen Namen wie dem
    des Benutzers erstellen
    -o, –non-unique Benutzer mit doppelter (nicht einmaliger)
    UID erlauben
    -p, –password PASSWORT Verschlüsseltes Passwort für den neuen
    Benutzerzugang
    -r, –system Eine Systemgruppe erstellen
    -R, –root CHROOT_VERZ Verzeichnis für chroot
    -s, –shell SHELL Die Login-Shell des neuen Benutzerzugangs
    -u, –uid UID Benutzer-ID (UID) des neuen Benutzerzugangs
    -U, –user-group Eine Gruppe mit dem gleichen Namen wie dem
    des Benutzers erstellen
    -Z, –selinux-user SEBENUTZER Den Benutzernamen SEBENUTZER für die SELinux-
    Benutzer-Zuordnung verwenden

    1. Thanks for pointing this out. The dashes were there but the font used was showing it as a solid line. I fixed it to make it clearer.

  4. Hi Tim, thanks so much for this article.

    Will steps 5 onwards need to be repeated every time the config file is updated?

    Thanks

  5. nice info here but it doesn’t work for me
    i don’t have a dir homebridge in either /usr/local/bin and /usr/bin
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: activating (auto-restart) (Result: exit-code) since Fri 2016-11-11 09:52:32 UTC; 1s ago
    Process: 6880 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 6880 (code=exited, status=1/FAILURE)

    Nov 11 09:52:32 raspberrypi homebridge[6880]: at Server._publish (/usr/lib/node_modules/homebridge/lib/server.js:111:16)
    Nov 11 09:52:32 raspberrypi homebridge[6880]: at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:88:10)
    Nov 11 09:52:32 raspberrypi homebridge[6880]: at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10)
    Nov 11 09:52:32 raspberrypi systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE
    Nov 11 09:52:32 raspberry systemd[1]: Unit homebridge.service entered failed state.

    this when i do the status command
    when sudo journalctl -u homebridge
    — Logs begin at Thu 2016-11-03 11:17:01 UTC, end at Fri 2016-11-11 09:53:27 UTC. —
    Nov 11 09:40:32 raspberrypi systemd[1]: Starting Node.js HomeKit Server…
    Nov 11 09:40:32 raspberrypi systemd[1]: Started Node.js HomeKit Server.
    Nov 11 09:40:32 raspberrypi systemd[1]: homebridge.service: main process exited, code=exited, status=203/EXEC
    Nov 11 09:40:32 raspberrypi systemd[1]: Unit homebridge.service entered failed state.
    Nov 11 09:40:42 raspberrypi systemd[1]: homebridge.service holdoff time over, scheduling restart.
    Nov 11 09:40:42 raspberrypi systemd[1]: Stopping Node.js HomeKit Server…
    Nov 11 09:40:42 raspberrypi systemd[1]: Starting Node.js HomeKit Server…
    Nov 11 09:40:42 raspberrypi systemd[1]: Started Node.js HomeKit Server.
    Nov 11 09:40:42 raspberrypi systemd[1]: homebridge.service: main process exited, code=exited, status=203/EXEC
    Nov 11 09:40:42 raspberrypi systemd[1]: Unit homebridge.service entered failed state.
    Nov 11 09:40:53 raspberrypi systemd[1]: homebridge.service holdoff time over, scheduling restart.
    Nov 11 09:40:53 raspberrypi systemd[1]: Stopping Node.js HomeKit Server…
    Nov 11 09:40:53 raspberrypi systemd[1]: Starting Node.js HomeKit Server…
    Nov 11 09:40:53 raspberrypi systemd[1]: Started Node.js HomeKit Server.
    Nov 11 09:40:53 raspberrypi systemd[1]: homebridge.service: main process exited, code=exited, status=203/EXEC
    Nov 11 09:40:53 raspberrypi systemd[1]: Unit homebridge.service entered failed state.
    Nov 11 09:41:03 raspberrypi systemd[1]: homebridge.service holdoff time over, scheduling restart.
    Nov 11 09:41:03 raspberrypi systemd[1]: Stopping Node.js HomeKit Server…
    Nov 11 09:41:03 raspberrypi systemd[1]: Starting Node.js HomeKit Server…
    Nov 11 09:41:03 raspberrypi systemd[1]: Started Node.js HomeKit Server.
    Nov 11 09:41:03 raspberry systemd[1]: homebridge.service: main process exited, code=exited, status=203/EXEC

    can you help me plz , im having trobles with this for 2 weeks now , tried everything

  6. don’t know what i have changed but it seems to work now ,
    think had something 2 do with the rights to the folder of persist
    nice example here of never give up

  7. Hi, all went ok, thank you!
    now i’m in trouble when adding a new one plugin and edit the config.json.
    i can install the plugin correctly, i edit the config.json (lacated in /var/homebridge : the new path) but the service can’t start.
    have i to do something else?
    Thank you

    1. roll-back to the old config.json configuration and all works like before.. the json was validated online so it doesn’t seem a json’s valid file.. maybe the plugin?

  8. on ubuntu 16.10 I get this
    root@ubuntu:/home/jerry# systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Wed 2016-12-14 18:49:44 CST; 1s ago
    Process: 1922 ExecStart=/usr/local/node/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=126)
    Main PID: 1922 (code=exited, status=126)

    Dec 14 18:49:44 ubuntu systemd[1]: homebridge.service: Unit entered failed state.
    Dec 14 18:49:44 ubuntu systemd[1]: homebridge.service: Failed with result ‘exit-code’.
    root@ubuntu:/home/jerry#

  9. Hi,

    Tried these steps and the service keeps exiting:

    pi@homebridge:/var/homebridge $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: activating (auto-restart) (Result: exit-code) since Thu 2016-12-15 11:21:42 UTC; 2s ago
    Process: 2866 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 2866 (code=exited, status=1/FAILURE)

    I can’t find any log files to help and despite uncommenting the DEBUG=*line in /etc/default/homebridge, journalctl just comes back with no entries found. Can you give pointers as to where I may look for errors/get jornaling working?

    Thanks,

    Dave

    1. Without an error message I’m not really sure what could be causing it. You could try follow the steps again and make sure you didn’t miss anything.

  10. Lifx bulb gets loaded but right after, I get a dns service error:name conflict. Any ideas? Appreciate the post was very helpful and thanks in advance.

    [12/17/2016, 8:12:10 AM] Loading 1 platforms…
    [12/17/2016, 8:12:10 AM] [LiFx] Initializing LifxLan platform…
    Scan this code with your HomeKit App on your iOS device to pair with Homebridge:

    ┌────────────┐
    │ 031-45-154 │
    └────────────┘

    /usr/local/lib/node_modules/hap-nodejs/node_modules/mdns/lib/advertisement.js:56
    dns_sd.DNSServiceRegister(self.serviceRef, flags, ifaceIdx, name,
    ^

    Error: dns service error: name conflict
    at Error (native)
    at new Advertisement (/usr/local/lib/node_modules/hap-nodejs/node_modules/mdns/lib/advertisement.js:56:10)
    at Object.create [as createAdvertisement] (/usr/local/lib/node_modules/hap-nodejs/node_modules/mdns/lib/advertisement.js:64:10)
    at Advertiser.startAdvertising (/usr/local/lib/node_modules/hap-nodejs/lib/Advertiser.js:43:30)
    at Bridge.Accessory._onListening (/usr/local/lib/node_modules/hap-nodejs/lib/Accessory.js:539:20)
    at emitOne (events.js:77:13)
    at HAPServer.emit (events.js:169:7)
    at HAPServer._onListening (/usr/local/lib/node_modules/hap-nodejs/lib/HAPServer.js:190:8)
    at emitOne (events.js:77:13)
    at EventedHTTPServer.emit (events.js:169:7)
    root@raspberrypi:~/.homebridge#

      1. no accessories or platforms, still see this error info:
        /usr/local/lib/node_modules/hap-nodejs/node_modules/mdns/lib/advertisement.js:56
        dns_sd.DNSServiceRegister(self.serviceRef, flags, ifaceIdx, name,
        ^

        Error: dns service error: unknown
        at Error (native)
        at new Advertisement (/usr/local/lib/node_modules/hap-nodejs/node_modules/mdns/lib/advertisement.js:56:10)
        at Object.create [as createAdvertisement] (/usr/local/lib/node_modules/hap-nodejs/node_modules/mdns/lib/advertisement.js:64:10)
        at Advertiser.startAdvertising (/usr/local/lib/node_modules/hap-nodejs/lib/Advertiser.js:43:30)
        at Bridge.Accessory._onListening (/usr/local/lib/node_modules/hap-nodejs/lib/Accessory.js:611:20)
        at emitOne (events.js:96:13)
        at HAPServer.emit (events.js:188:7)
        at HAPServer._onListening (/usr/local/lib/node_modules/hap-nodejs/lib/HAPServer.js:190:8)
        at emitOne (events.js:96:13)
        at EventedHTTPServer.emit (events.js:188:7)

  11. This is great!
    I also managed to install homebridge alright.
    Had trouble though getting it to boot on startup, followed your steps and, success!
    Thanx!

  12. Great procedure, which works right away 🙂

    I like to have a log file to see what the HomeBridge is logging (ie by using the HomeBridge server plugin)

    I uncommented the “DEBUG=*” line, but don’t know where to look for the log file.

    Any help would be appreciated .

    Thanks,
    Rien

  13. Hi Tim,

    No journal files were found….

    And I need it in a log file for the HomeBridge Server plugin.

    Any other ideas ?

    1. Tim, I need your help again. Home bridge was not found a couple hours after your help the other day; I started fresh to see if I missed something yesterday. and it took a couple hours to stop again. I also disabled power management for wifi to keep it from going to sleep. it says that it is active, yet homebridge will not show up once removed. Please look below.
      pi@raspberrypi:~ $ systemctl status homebridge
      ● homebridge.service – Node.js HomeKit Server
      Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
      Active: active (running) since Wed 2017-01-11 00:24:29 UTC; 4min 34s ago
      Main PID: 562 (homebridge)
      CGroup: /system.slice/homebridge.service
      └─562 homebridge
      pi@raspberrypi:~ $ sudo systemctl status homebridge
      ● homebridge.service – Node.js HomeKit Server
      Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
      Active: active (running) since Wed 2017-01-11 00:24:29 UTC; 4min 44s ago
      Main PID: 562 (homebridge)
      CGroup: /system.slice/homebridge.service
      └─562 homebridge

      Jan 11 00:27:30 raspberrypi homebridge[562]: [1/11/2017, 12:27:30 AM] [Fan] …]
      Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Update…d
      Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Away f…e
      Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Temper…t
      Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Curren…9
      Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Curren…0
      Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Curren…2
      Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Target…2
      Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Target…4
      Jan 11 00:28:33 raspberrypi systemd[1]: Started Node.js HomeKit Server.
      Hint: Some lines were ellipsized, use -l to show in full.
      pi@raspberrypi:~ $

      REPLY

  14. Hi Tim,
    I followed your guide and now my homebridge works like a charm!
    Just a question: what’s the config.json that have to be modified now? The one in ~/.homebridge or the other in /var/homebridge ?

      1. Everything works perfect using this guide! however not sure how to change / update config.json I changed a few items but they are not reflected in the Homekit. Do i need to stop process and reload? Reboot does not help.

  15. once I try to log in to homebridge it just goes in a loop, back to login. I can log in to PI fine, yet not homebridge. it goes blank and ask for my login again. I have ran in to this twice now, the first time I sent it in to recovery and loaded a new Jessie on my rpi3. Is there a way to do steps 4-10 logged in as Pi? Thank you for your help.

  16. Tim, you are the smartest guy around. This was a simple process thanks to you. I wasted an half a day on that other site, and a an hour on google trying to find the fix. Thank you Sir.

  17. Jan 09 03:55:50 RazHome homebridge[2588]: at Module._compile (module.js:571:32)
    Jan 09 03:55:50 RazHome homebridge[2588]: at Object.Module._extensions..js (…)
    Jan 09 03:55:50 RazHome homebridge[2588]: at Module.load (module.js:488:32)
    Jan 09 03:55:50 RazHome homebridge[2588]: at tryModuleLoad (module.js:447:12)
    Jan 09 03:55:50 RazHome homebridge[2588]: at Function.Module._load (module.j…)
    Jan 09 03:55:50 RazHome homebridge[2588]: at Module.runMain (module.js:605:10)
    Jan 09 03:55:50 RazHome systemd[1]: homebridge.service: main process exited…RE
    Jan 09 03:55:50 RazHome systemd[1]: Unit homebridge.service entered failed …e.
    Hint: Some lines were ellipsized, use -l to show in full.

    any ideas what im doing wrong?

  18. Hi, i have tested this and I end up with a error when i try to enable homebridge..

    pi@raspberrypi:~ $ sudo systemctl enable homebridge
    Synchronizing state for homebridge.service with sysvinit using update-rc.d…
    Executing /usr/sbin/update-rc.d homebridge defaults
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = “UTF-8”,
    LANG = “en_US.UTF-8”
    are supported and installed on your system.
    perl: warning: Falling back to a fallback locale (“en_US.UTF-8”).
    Executing /usr/sbin/update-rc.d homebridge enable
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = “UTF-8”,
    LANG = “en_US.UTF-8”
    are supported and installed on your system.
    perl: warning: Falling back to a fallback locale (“en_US.UTF-8”).
    pi@raspberrypi:~ $ sudo systemctl start homebridge
    pi@raspberrypi:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: active (running) since Mon 2017-01-09 20:38:48 UTC; 13min ago
    Main PID: 524 (homebridge)
    CGroup: /system.slice/homebridge.service
    └─524 homebridge
    pi@raspberrypi:~ $

    Any clue?

  19. Tim, I need your help again. Home bridge was not found a couple hours after your help the other day; I started fresh to see if I missed something yesterday. and it took a couple hours to stop again. I also disabled power management for wifi to keep it from going to sleep. it says that it is active, yet homebridge will not show up once removed. Please look below.
    pi@raspberrypi:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: active (running) since Wed 2017-01-11 00:24:29 UTC; 4min 34s ago
    Main PID: 562 (homebridge)
    CGroup: /system.slice/homebridge.service
    └─562 homebridge
    pi@raspberrypi:~ $ sudo systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: active (running) since Wed 2017-01-11 00:24:29 UTC; 4min 44s ago
    Main PID: 562 (homebridge)
    CGroup: /system.slice/homebridge.service
    └─562 homebridge

    Jan 11 00:27:30 raspberrypi homebridge[562]: [1/11/2017, 12:27:30 AM] [Fan] …]
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Update…d
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Away f…e
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Temper…t
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Curren…9
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Curren…0
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Curren…2
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Target…2
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Target…4
    Jan 11 00:28:33 raspberrypi systemd[1]: Started Node.js HomeKit Server.
    Hint: Some lines were ellipsized, use -l to show in full.
    pi@raspberrypi:~ $

  20. Hello Tim
    Thanks for the article.
    It works for me but I am not able to stop home bridge.
    Which commands do I need to simply stop home bridge if I temporary need to start it manually?
    thanks
    Fab

  21. Tim, I need your help again. Home bridge was not found a couple hours after your help the other day; I started fresh to see if I missed something yesterday. and it took a couple hours to stop again. I also disabled power management for wifi to keep it from going to sleep. it says that it is active, yet homebridge will not show up once removed. Please look below.
    pi@raspberrypi:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: active (running) since Wed 2017-01-11 00:24:29 UTC; 4min 34s ago
    Main PID: 562 (homebridge)
    CGroup: /system.slice/homebridge.service
    └─562 homebridge
    pi@raspberrypi:~ $ sudo systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: active (running) since Wed 2017-01-11 00:24:29 UTC; 4min 44s ago
    Main PID: 562 (homebridge)
    CGroup: /system.slice/homebridge.service
    └─562 homebridge

    Jan 11 00:27:30 raspberrypi homebridge[562]: [1/11/2017, 12:27:30 AM] [Fan] …]
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Update…d
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Away f…e
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Temper…t
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Curren…9
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Curren…0
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Curren…2
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Target…2
    Jan 11 00:28:16 raspberrypi homebridge[562]: [1/11/2017, 12:28:16 AM] Target…4
    Jan 11 00:28:33 raspberrypi systemd[1]: Started Node.js HomeKit Server.
    Hint: Some lines were ellipsized, use -l to show in full.
    pi@raspberrypi:~ $

    Any thoughts

  22. Hi Tim,
    Ive done everything you mentioned except when i hit sudo systemctl enable home bridge i get the following error:
    pi@raspberrypi:~ $ sudo systemctl enable homebridge
    Synchronizing state for homebridge.service with sysvinit using update-rc.d…
    Executing /usr/sbin/update-rc.d homebridge defaults
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.
    Executing /usr/sbin/update-rc.d homebridge enable
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.
    insserv: Script homebridge is broken: incomplete LSB comment.
    insserv: missing valid name for `Provides:’ please add.

    thoughts?

  23. I have 2 things to helpout with.
    to see journal logs I have to run the following hopefully this can help others
    sudo journalctl -u homebridge -f

    Second if anyone is having couldn’t connect to this accessory from device to homebridge verify how many accessories you have, I have one platform openHAB but every accessory created in it or item is concidered an accessory. there is no error for over 100 accessories and 100 is the max per homebridge. For the openhab to homebrige addon there is a skipitem true function you can add to your config.json which will not sync the items you do not need. This will take time to sync mine took around 24 hours before I could access the accessories just use the journal line above and once it starts showing your accessories getting data not resgitering you will be good.
    Hope this helps anyone with this issue

  24. I struggled with NFarinas and the main guide too. had to reinstall RPI from scratch! Twice… so I am nervous about following your process.
    I have homebridge up and running manualy with 2 plugins (Smartthings and nest) working fine.
    If I now install following your process:
    Your approach has some subtle differences.
    1. Nfarina’s guide suggests /var/lib/homebridge as the directory …you and others seem to be using just var/homebridge.. Is there a reason for this?
    2. This means we would have to edit the homebridge file in etc/defaults/because it references var/lib/homebridge. Is this correct?
    3. on my previous attempts it wouldn’t find the plugins or the accessories… \I read posts about copying the persist folder but it didn’t seem to work 100% . Any thoughts?

    1. Folder structure is most likely bc of different operating systems. Are you installing it on a raspberry pi? You should be fine modifying the steps if your directories are different.

      1. I was installing on fresh RPI with noobs
        Followed farina process all the way through and RPI and Homebridge working perfectly on RPI manually

        I know I “should” be safe to do this but I’ve done it twice and it’s not worked. Would it matter which version of nodejs etc? (I am running 7.5.0)

  25. Hi!

    I’m having a little trouble.

    Just running the homebridge binary works flawlessly, the service on the other hand does not.

    systemctl status homebridge ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: activating (auto-restart) (Result: exit-code) since tis 2017-02-28 22:26:57 CET; 2s ago
    Process: 7989 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 7989 (code=exited, status=1/FAILURE)
    pi@raspberrypi:~ $

    Any ideas?

      1. Thanks, and by the way, thanks for a great guide!

        Haven’t had the opportunity to test yet but I’m curious as to why there’s $HOMEBRIDGE_OPTS in the service when it’s not needed when starting manually, shouldn’t be necessary?

          1. Ok, makes sense!

            Got it working now, went step by step again and it turned out I’d forgotten the “-R” flag when copying the “persist” directory so it was just an empty folder!

            Thanks a bunch!

  26. Hi, firstly thanks for posting this run through, so much clearer than the official documentation. I ran into a problem at step 9 though, after typing “sudo systemctl enable homebridge” i get an ERROR: Invalid argument response. Any idea why?

      1. I found my problem. I hadn’t copied the whole gist, I had left out the last t from the end of the word “target” in homebridge.service, once I edited the file I could run the enable command no problem. Now homebridge runs all the time, every time! Thank you so, so much for posting these instructions.

  27. I’m sorry, I have a silly question. Once I paste the gists into the files, how do I exit and save them. In a separate tab, I subsequently get:

    pi@raspberrypi:~ $ sudo systemctl enable homebridge
    Failed to execute operation: No such file or directory

    I must therefore have failed to create the directory.

  28. Hi, my apologies. I managed to save the gists.

    I am now getting this message:

    i:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: activating (auto-restart) (Result: exit-code) since Wed 2017-03-22 17:48:28 UTC; 2s ago
    Process: 19091 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 19091 (code=exited, status=1/FAILURE)

    Would anyone please be able to help me?

      1. Hi Tim, thank you but I realised that I had a typo in one of the files. All working now! Thank you very much.

  29. Tim,
    Just found this page. I have been struggling to set up Homebridge on my PI. This looks really helpful. Think I will start again from scratch rather than try and overlay onto what does not work now. Just need a couple of hours over next few days. Hopefully will not need to comeback to you!

    Regards Tony

  30. Hi Tim

    I’m sorry to plague you for advice.

    I have homebridge running on boot up of my Raspberry Pi 3 as guided by your instructions above re systemd.

    I was hoping to install a second plugin, in addition to the one governing my LIFX lightbulbs.
    However, when I type:

    npm install -g homebridge-platform-wemo

    I get:

    npm WARN checkPermissions Missing write access to /usr/lib/node_modules
    /usr/lib
    └─┬ [email protected]
    ├─┬ [email protected]
    │ └── [email protected]
    └─┬ [email protected].2
    ├─┬ [email protected]
    │ └── [email protected]
    ├── [email protected]
    ├─┬ [email protected]
    │ └── [email protected]
    ├─┬ [email protected]
    │ ├── [email protected]
    │ └─┬ [email protected]
    │ └── [email protected].4
    └── [email protected]

    npm ERR! Linux 4.4.50-v7+
    npm ERR! argv “/usr/bin/nodejs” “/usr/bin/npm” “install” “-g” “homebridge-platform-wemo”
    npm ERR! node v6.10.1
    npm ERR! npm v3.10.10
    npm ERR! path /usr/lib/node_modules
    npm ERR! code EACCES
    npm ERR! errno -13
    npm ERR! syscall access

    npm ERR! Error: EACCES: permission denied, access ‘/usr/lib/node_modules’
    npm ERR! at Error (native)
    npm ERR! { Error: EACCES: permission denied, access ‘/usr/lib/node_modules’
    npm ERR! at Error (native)
    npm ERR! errno: -13,
    npm ERR! code: ‘EACCES’,
    npm ERR! syscall: ‘access’,
    npm ERR! path: ‘/usr/lib/node_modules’ }
    npm ERR!
    npm ERR! Please try running this command again as root/Administrator.

    npm ERR! Please include the following file with any support request:
    npm ERR! /home/pi/npm-debug.log

    I don’t seem to have permission to install the second plugin. Would you have any advice re how to do so?

      1. Hi Tim

        I’m sorry, I realise that was the equivalent of not trying the plug it out plug it back in approach. Sorry, I’m a newbie!

        Thanks for your help, I’ve managed to get it installed! Would you also be able to tell me how to edit the config.json on my raspberry pi from the command line (I’ve sshed in to a headless system).

        Kind regards

        Tom

  31. Hey Tim,

    it just seems to have worked without me evening editing the config file! I can see my wemo devices and they all work! I’m not entirely sure what to make of that, but I’m happy!

    Thanks for your help!

  32. Hi Tim,

    I followed this and was able to get it working! but only temporarily. If I run `systemctl status homebridge` a few times, I can see that it starts up for a couple seconds, but then gets killed and is usually in the auto-restart state.

    Did you ever run into this problem?

      1. I found a fix, which was to comment out the `User=homebridge` in the homebridge.service file.

        I had my homebridge working as an accessory in HomeKit before, when I ran `sudo homebridge`. But when it is running as a service, my HomeKit app does not find the accessory. Is this a different instance of homebridge?

          1. It was something relating to the config.

            I think the problem was that the copied config.json from my non-bootup setup had the same bridge name/username/HomeKit PIN. I’m not sure which of the above it is, but I changed all 3 to be a new unique value, added that new accessory to HomeKit, and it works now.

  33. Hi Tim thought I was doing so well.
    I got Homebrige running but did not put in any accessories. Then went and got half way through start on boot and realised with no accessories i needed to stop.
    Tried to load an accessory and getting an error.

    Think I probably need to start all over again even though Hombridge is running

    npm install -g homebridge-gpio-garagedoor
    npm WARN checkPermissions Missing write access to /usr/lib/node_modules
    /usr/lib
    └─┬ [email protected]
    ├── [email protected]
    └─┬ [email protected]
    └─┬ [email protected]
    ├── [email protected]
    └── [email protected]

    npm ERR! Linux 4.4.50-v7+
    npm ERR! argv “/usr/bin/nodejs” “/usr/bin/npm” “install” “-g” “homebridge-gpio-garagedoor”
    npm ERR! node v7.8.0
    npm ERR! npm v4.2.0
    npm ERR! path /usr/lib/node_modules
    npm ERR! code EACCES
    npm ERR! errno -13
    npm ERR! syscall access

    npm ERR! Error: EACCES: permission denied, access ‘/usr/lib/node_modules’
    npm ERR! { Error: EACCES: permission denied, access ‘/usr/lib/node_modules’
    npm ERR! errno: -13,
    npm ERR! code: ‘EACCES’,
    npm ERR! syscall: ‘access’,
    npm ERR! path: ‘/usr/lib/node_modules’ }
    npm ERR!
    npm ERR! Please try running this command again as root/Administrator.

    npm ERR! Please include the following file with any support request:
    npm ERR! /home/pi/.npm/_logs/2017-04-11T12_48_18_707Z-debug.log
    pi@raspberrypi:~ $ /home/pi/.npm/_logs/2017-04-11T12_48_18_707Z-debug.lo
    -bash: /home/pi/.npm/_logs/2017-04-11T12_48_18_707Z-debug.lo: No such file or directory
    pi@raspberrypi:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: error (Reason: Invalid argument)
    Active: inactive (dead)
    pi@raspberrypi:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: error (Reason: Invalid argument)
    Active: inactive (dead)

      1. Hi the sudo command as you suggested has moved me forward.

        I presume the line
        [4/13/2017, 1:37:25 PM] config.json (/home/pi/.homebridge/config.json) not found.

        Is now what is causing the problem.
        The accessory is showing .

        Appreciate your input.
        Regards

        Tony
        pi@raspberrypi:~ $ homebridge
        *** WARNING *** The program ‘nodejs’ uses the Apple Bonjour compatibility layer of Avahi.
        *** WARNING *** Please fix your application to use the native API of Avahi!
        *** WARNING *** For more information see
        *** WARNING *** The program ‘nodejs’ called ‘DNSServiceRegister()’ which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
        *** WARNING *** Please fix your application to use the native API of Avahi!
        *** WARNING *** For more information see
        [4/13/2017, 1:37:24 PM] Loaded plugin: homebridge-gpio-garagedoor
        [4/13/2017, 1:37:25 PM] Registering accessory ‘homebridge-gpio-garagedoor.GPIOGarageDoor’
        [4/13/2017, 1:37:25 PM] —
        [4/13/2017, 1:37:25 PM] config.json (/home/pi/.homebridge/config.json) not found.
        Scan this code with your HomeKit App on your iOS device to pair with Homebridge:

        ┌────────────┐
        │ 031-45-154 │
        └────────────┘

        [4/13/2017, 1:37:25 PM] Homebridge is running on port 46058.

          1. hi just reinstalled using sudo npm install -g –unsafe-perm homebridge

            Still same error
            config.json (/home/pi/.homebridge/config.json) not found

  34. Hi Tim sorry to keep sending so many posts but making progress.

    I put a config.json file in the home bridge folder and now get this error.

    rageDoor’
    [4/13/2017, 2:48:35 PM] —
    [4/13/2017, 2:48:35 PM] There was a problem reading your config.json file.
    [4/13/2017, 2:48:35 PM] Please try pasting your config.json file here to validate it: http://jsonlint.com
    [4/13/2017, 2:48:35 PM]
    /usr/lib/node_modules/homebridge/lib/server.js:197
    throw err;

    The config file comes from https://www.npmjs.com/package/homebridge-gpio-garagedoor

    And is

    “accessories”: [
    {
    “accessory”: “GPIOGarageDoor”,
    “name”: “Garage Door”,
    “doorSwitchPin”: 23,
    “doorSensorPin”: 24,
    “isNCSensor”: false,
    “doorOpensInSeconds”: 14
    }
    ]

    Maybe I am not copying it in correctly?

    Kind regards

    Tony

    1. Sounds like it’s not correct json format. Look at the sample and make sure you are not missing anything. Validate it using a json parser

  35. Hi Tim, Im newbie here and just managed to finish all the setup. but can you provide the result of “systemctl status homebridge”, Im a bit confused here whether my systemd bootup is running or not.

    Also I configure my rasp-pi 3 with ssh on mac, when I run $ homebridge in the terminal, its running successfully. What should i do to keep it running because when i quit the terminal (Command+q), the homebridge hub in my iphone home app has no response which means it stopped running. Is there some command that I miss here?

    Thanks for the help…

      1. Yes, ive tried that and still not working. When i plug my hdmi monitor to my rasp-pi, its stucked at login page.

          1. So the login page. I would recommend going through the steps again to see if you missed anything. You shouldn’t have to login. It should start automatically.

  36. This worked perfectly for me.

    Just one question: now when I enter $ homebridge it gives me the error that homebridge is already in use (which of course it is). No problem, except what happens when I want to make a change to homebridge? How do I kill the process and start it again manually in a new command line window?

    Thanks for the help!

          1. To stop homebridge service type “systemctl stop homebridge” to start the service again type “systemctl start homebridge”

  37. Hi! Great tutorial but I messed some stuff up and I think I have multiple instances of Homebridge running now and it’s not working properly. How do I remove homebridge and reinstall it now that I have it running on startup?

  38. Hi Tim
    Why this: sudo cp ~/.homebridge/config.json /var/homebridge/
    Why not using the original ~/.homebridge/config.json instead?
    Thx

  39. Hi Tim,

    I have followed your instructions (which was great btw.) however I seem to have the same problem as someone before me has reported. If I start it manually (i.e. typing homebridge), I can see it loading accessories etc. and works like a charm (it loads using the pi user). However, when I load it on boot it seems to crash every 10 seconds or so and then restarts. I tried as above, changing in the original config.json file (name, PIN etc.), did not work. I also tried to comment out the User in the service file, did not work.

    I am clueless how to proceed. Can I view a log somewhere so I can get a sense of what is happening. If I would guess anything it is something about permissions for the homebridge user…

    As a workaround I’m now running the service as pi and point to the original config.json. I’m not at home right now so I’m not sure if it works but it doesn’t crash now at least.

  40. Hi Tim,

    Thanks for the great tutorial. I seem to be having a few permission issues with a couple of my plugins when attempting to get the service up and running.

    -My config file is good and homebridge loads fine when not running as a service
    -When I start the service I see these errors in the log:

    “Jul 03 13:26:19 UbuntuServer homebridge[43513]: [7/3/2017, 1:26:19 PM] Loaded config.json with 0 accessories and 3 platforms.
    Jul 03 13:26:19 UbuntuServer homebridge[43513]: [7/3/2017, 1:26:19 PM] —
    Jul 03 13:26:19 UbuntuServer homebridge[43513]: [7/3/2017, 1:26:19 PM] Loading 3 platforms…
    Jul 03 13:26:19 UbuntuServer homebridge[43513]: [7/3/2017, 1:26:19 PM] [isy-js] Initializing isy-js platform…
    Jul 03 13:26:19 UbuntuServer homebridge[43513]: [7/3/2017, 1:26:19 PM] [ISYMaker] Initializing isy-maker platform…
    Jul 03 13:26:19 UbuntuServer homebridge[43513]: /usr/lib/node_modules/homebridge/lib/api.js:122
    Jul 03 13:26:19 UbuntuServer homebridge[43513]: throw new Error(“The requested platform ‘” + name + “‘ was not registered by any plugin.”);
    Jul 03 13:26:19 UbuntuServer homebridge[43513]: ^
    Jul 03 13:26:19 UbuntuServer homebridge[43513]: Error: The requested platform ‘HarmonyHub’ was not registered by any plugin.
    Jul 03 13:26:19 UbuntuServer homebridge[43513]: at API.platform (/usr/lib/node_modules/homebridge/lib/api.js:122:13):

    -It appears there is some kind of permission issue with my ISYMaker and HarmonyHub plugins.
    -If I run the service as a normal user (non-system user) then the service will start correctly but will eventually error out on “..Error: EACCES: permission denied, open ‘/var/homebridge/accessories/cachedAccessories’…” likely because the normal user doesn’t have the right permissions to /var/homebridge/accessories

    If you have any suggestions how to fix my permission issues I would sure appreciate it.

    Thanks in advance,

    Brian

  41. i can not run homebridge from systemctl but can run by command homebridge
    it show below

    pi@raspberrypi:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: activating (auto-restart) (Result: exit-code) since Sun 2017-07-30 15:21:02 UTC; 8s ago
    Process: 1839 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 1839 (code=exited, status=1/FAILURE)
    pi@raspberrypi:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: active (running) since Sun 2017-07-30 15:21:12 UTC; 1s ago
    Main PID: 1861 (homebridge)
    CGroup: /system.slice/homebridge.service
    ├─1861 homebridge
    ├─1867 /bin/sh -c /bin/echo -n “$(npm -g prefix)/lib/node_modules”…
    └─1868 node /usr/bin/npm -g prefix
    pi@raspberrypi:~ $

    what should i do
    thx for your answer

  42. HI Tim,

    I have tried all the combinations in your blog, but not one of them works on my system. The errors change depending on what I try, but the latest and probably the most simplest answer will be to why I get this error after 5 seconds go starting:
    path.js:7
    Jul 31 13:31:26 Pixel-Pi homebridge[1941]: throw new TypeError(‘Path must be a string. Received ‘ + inspect(path));
    Jul 31 13:31:26 Pixel-Pi homebridge[1941]: ^
    Jul 31 13:31:26 Pixel-Pi homebridge[1941]: TypeError: Path must be a string. Received undefined
    Jul 31 13:31:26 Pixel-Pi homebridge[1941]: at assertPath (path.js:7:11)
    Jul 31 13:31:26 Pixel-Pi homebridge[1941]: at Object.join (path.js:1211:7)
    Jul 31 13:31:26 Pixel-Pi homebridge[1941]: at Function.User.storagePath (/opt/node/lib/node_modules/homebridge/lib/user.js:30:15)
    Jul 31 13:31:26 Pixel-Pi homebridge[1941]: at Function.User.persistPath (/opt/node/lib/node_modules/homebridge/lib/user.js:38:25)
    Jul 31 13:31:26 Pixel-Pi homebridge[1941]: at module.exports (/opt/node/lib/node_modules/homebridge/lib/cli.js:24:17)
    Jul 31 13:31:26 Pixel-Pi homebridge[1941]: at Object. (/opt/node/lib/node_modules/homebridge/bin/homebridge:17:22)
    Jul 31 13:31:26 Pixel-Pi homebridge[1941]: at Module._compile (module.js:570:32)
    Jul 31 13:31:26 Pixel-Pi homebridge[1941]: at Object.Module._extensions..js (module.js:579:10)
    Jul 31 13:31:26 Pixel-Pi homebridge[1941]: at Module.load (module.js:487:32)
    Jul 31 13:31:26 Pixel-Pi homebridge[1941]: at tryModuleLoad (module.js:446:12)
    Jul 31 13:31:26 Pixel-Pi systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE
    Jul 31 13:31:26 Pixel-Pi systemd[1]: Unit homebridge.service entered failed state.

    I can run the home bridge code from the command line but not as a service. I have set other software up as a service, but can’t seem to get homebridge to run. Also I have not found a definitive answer to this error. I’m still searching through the google search. Do you have quick answer?

    Running on a Pi3 Here is the output from some commands the other people have asked for with this issue:
    ls -ahl /var/lib/homebridge
    total 12K
    drwxrwxrwx 2 root root 4.0K Jul 19 10:10 .
    drwxr-xr-x 52 root root 4.0K Jul 19 10:08 ..
    -rwxrwxrwx 1 root root 491 Jul 19 10:10 config.json

    homebridge.service file:

    Description=HomeBridge

    Wants=network.target
    After=syslog.target network-online.target

    [Service]
    Type=simple
    ExecStart=/opt/node/bin/homebridge
    Restart=on-failure
    RestartSec=10
    KillMode=process

    [Install]
    WantedBy=multi-user.target

    whereis homebridge
    homebridge: /opt/node/bin/homebridge

    sudo systemctl status homebridge tells me it’s running, but it’s not.

    Thanks!

    1. What does your config.json look like? Is there something that is causing this TypeError: Path must be a string. Received undefined?
      I wrote another post that simplified running something on boot that may help.

      1. Hi Tim,

        I did a clean install of the Pi OS, npm and homebridge and I still cannot get the daemon to work following either of your instructions:
        Aug 17 14:12:19 Homebridge homebridge[8817]: at Function.User.storagePath (/usr/lib/node_modules/homebridge/lib/user.js:30:15)
        Aug 17 14:12:19 Homebridge homebridge[8817]: at Function.User.persistPath (/usr/lib/node_modules/homebridge/lib/user.js:38:25)
        Aug 17 14:12:19 Homebridge homebridge[8817]: at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:24:17)
        Aug 17 14:12:19 Homebridge homebridge[8817]: at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
        Aug 17 14:12:19 Homebridge homebridge[8817]: at Module._compile (module.js:571:32)
        Aug 17 14:12:19 Homebridge homebridge[8817]: at Object.Module._extensions..js (module.js:580:10)
        Aug 17 14:12:19 Homebridge homebridge[8817]: at Module.load (module.js:488:32)
        Aug 17 14:12:19 Homebridge homebridge[8817]: at tryModuleLoad (module.js:447:12)
        Aug 17 14:12:19 Homebridge systemd[1]: HB.service: main process exited, code=exited, status=1/FAILURE
        Aug 17 14:12:19 Homebridge systemd[1]: Unit HB.service entered failed state.

        Should I have “sudo homebridge” in the service file?
        —-
        Description=Homebridge

        Wants=network.target
        After=syslog.target network-online.target

        [Service]
        Type=simple
        ExecStart= /usr/bin/homebridge
        Restart=on-failure
        RestartSec=10
        KillMode=process

        [Install]
        WantedBy=multi-user.target

        —–
        my homebridge file is located at : /usr/bin/homebridge

        Thanks for any help you have in solving this issue.

          1. No. This is what my install looks like:
            ~ $ cd /usr/local/bin
            pi@Homebridge:/usr/local/bin $ ls
            pi@Homebridge:/usr/local/bin $ ls
            pi@Homebridge:/usr/local/bin $ whereis homebridge
            homebridge: /usr/bin/homebridge
            pi@Homebridge:/usr/local/bin $ ls -l /usr/bin/homebridge
            lrwxrwxrwx 1 root root 45 Aug 17 13:30

            Looks like link is made the file in /lib/node_modules/homebridge/bin/homebridge

            Should I make a link in /use/local/bin?

            Thanks

  43. Hi Tim,

    Wouldn’t I get a that error form the command line also? Here is the config.json file:
    {
    “bridge”: {
    “name”: “Homebridge”,
    “username”: “CC:22:3D:E3:CE:31”,
    “port”: 51826,
    “pin”: “031-45-154”
    },

    “description”: “This is an example configuration file with one fake accessor
    y and one fake platform. You can use this as a template for creating your own co
    nfiguration file containing devices you actually own.”,

    “accessories”: [
    {
    “accessory”: “homebridge-rpitemp.RpiTemp”,
    “name”: “RPi CPU Temp”,
    “tempid”: “cpu”
    },
    {
    “accessory”: “SamsungTV”,
    “name”: “TV”,
    “ip_address”: “192.168.1.99”,
    “send_delay”: 400 }
    ],

    “platforms”: [
    {
    “platform”: “BelkinWeMo”,
    “name”: “WeMo Platform”
    },

    {
    “platform”: “Hue”,
    “name”: “Hue”,
    “users”: {
    “001788FFFE099838”: “k6el9a1tm18K4ITh4J6wpY2XG28qqUUPWmpWvWdC”
    },
    “sensors”: false,
    “excludeSensorTypes”: [“CLIPPresence”, “Geofence”],
    “lights”: true,
    “philipsLights”: true,
    “wallSwitch”: false,
    “heartrate”: 30
    }

    ]

    }

    I’ve read both and tried both posts. The second one is the latest I tried and get the current error.

    Thanks once again..

  44. Quick question. With this method is there a way to view a log/access the output that homebridge usually displays on running? I like to check the times of events and I can’t find another way to access it. Thanks!

  45. My homebridge install works perfectly until I setup systemd to get it running on boot. Then I get this output from systemctl status:
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: activating (auto-restart) (Result: exit-code) since Tue 2017-08-15 04:37:38 UTC; 3s ago
    Process: 14865 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=127)
    Main PID: 14865 (code=exited, status=127)

    If I try to start Homebridge manually I get this message: node: relocation error: node: symbol ode, version GLIBC_2.4 not defined in file libc.so.6 with link time reference

    What on earth is wrong? Homebridge worked perfectly until I started messing with systemd

    1. Hi Olem

      I also can’t get homebridge to work with systemd, tried everything mentioned on several sites, with different locations, users. It just won’t run via systems. (it does work in the cli).

      I get the same error as mentioned above:
      homebridge.service: Main process exited, code=exited, status=127/n/a
      homebridge.service: Unit entered failed state.
      homebridge.service: Failed with result ‘exit-code’

      did you solve it?

  46. Hi Tim Could you plese help

    systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: activating (auto-restart) (Result: exit-code) since Sat 2017-08-19 12:44:31 AEST; 3s ago
    Process: 1239 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 1239 (code=exited, status=1/FAILURE)

    Why is this

  47. I too was having the problem where I could run homebridge successfully from the command line, but it would not run under systemd. What eventually got thing fixed for me allowing homebridge to run under systemd was editing /etc/systemd/system/homebridge.service

    On my system that now works, it looks like this:
    Of note, I have the service running under the user pi and I commented out EnvironmentFile
    I got this idea from: http://pysselilivet.blogspot.com/2017/01/homebridge-autostart-with-systemd.html
    Hope this helps.

    [Unit]
    Description=Node.js HomeKit Server
    After=syslog.target network-online.target

    [Service]
    Type=simple
    User=pi
    #EnvironmentFile=/etc/default/homebridge
    # Adapt this to your specific setup (could be /usr/bin/homebridge)
    # See comments below for more information
    ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS
    Restart=on-failure
    RestartSec=10
    KillMode=process

    [Install]
    WantedBy=multi-user.target

    1. This works 100% for me! I was suffering from the very much the same problems and had checked ownerships and completeness of all of the involved files/directories. Finally, after changing the User to “pi”, then:

      sudo systemctl daemon-reload
      sudo systemctl enable homebridge
      sudo systemctl start homebridge

      and checking with
      sudo systemctl status homebridge
      all is well!
      I even rebooted the Pi and it came right back. Thanks Jeff and Tim!

  48. It’s failing for me :(, can you please help.

    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Sat 2017-09-16 09:23:17 IST; 1s ago
    Process: 3098 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 3098 (code=exited, status=1/FAILURE)

    Sep 16 09:23:17 prashant_home systemd[1]: homebridge.service: Unit entered failed state.
    Sep 16 09:23:17 prashant_home systemd[1]: homebridge.service: Failed with result ‘exit-code’

  49. My Homebridge works well on my Raspberry Pi 3, but I cannot get autostart to work using the guidelines.
    I have checked the location of homebridge and included it in the Gist with ‘local’

    pi@raspberrypi:~ $ which homebridge
    /usr/local/bin/homebridge

    I get an error when I use systemctl status homebridge

    pi@raspberrypi:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: activating (auto-restart) (Result: exit-code) since Thu 2017-09-21 15:44:26 UTC; 8s ago
    Process: 17090 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 17090 (code=exited, status=1/FAILURE)

    1. I had the exact same problem, I figured out the user was the issue.
      When changing to my default PI user, the issue was gone and service is running.

      If anyone can suggest another approach of doing it correctly with the ‘homebridge’ user (which requires a password and that was the problem if i’m not wrong), please share.

      Thanks

    2. I had this issue as well – I’m using the Braoadlink RM plug in and I had to add the following line to the BroadlinkRM platform in /var/homebridge/config.json

      “homebridgeDirectory”:”/var/homebridge”,

      Hope this helps

  50. Hello,
    Just to say Thank you very much, I have some difficult to start my home bridge at startup and with your steps it’s works fine !!
    Thanks again!
    Morgane

  51. Hi TIM, I’ve done every step and I see the system is running
    homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: active (running) since Tue 2017-09-26 11:32:38 UTC; 14s ago
    Main PID: 692 (homebridge)
    CGroup: /system.slice/homebridge.service
    ├─692 homebridge
    ├─698 /bin/sh -c /bin/echo -n “$(npm -g prefix)/lib/node_modules”
    └─699 npm

    BUT when I go on my phone homekit doesn’t work, and in order to switch on my lights I have to start “homebridge” manually.
    What it can be?

          1. I don’t understand why create another user (called homebridge, too, to confuse ideas to noobs!).. should I do something with that user? If I try to switch from pi user to homebridge user, it asks me a password, which password?

            Thanks 🙂

    1. I had the same issue. I had to remove the bridge from my Home app and then re-pair it with the auto-started instance (even using the same HomeKit code) before it would work with the autostarted one.

  52. Hi, I’m new to all this and started out reading how to setup my homebridge on https://github.com/nfarina/homebridge/wiki/Running-HomeBridge-on-a-Raspberry-Pi#install-avahi-and-other-dependencies. The post refers to the post above in case you encounter some difficulties (aka troubleshooting). In the first post the homebridge config is stored in /var/homebridge, while in the post above the dir /var/lib/homebridge is used. Be sure the locations in you config are matching the directories you’ll be creating, so pick one or the other. After correcting the post above did the job for me, thanks!

  53. Hi Everybody,
    I’m new about “Raspberry PI” and homebridge application, I tried to apply Your tips, but unfortunately doesn’t work .
    It seem it start but after few seconds the status is FAILURE.
    My understanding is that if I start homebridge using “sudo systemctl start homebridge” do not load plug-in (I use Fibaro-HC2), but if I start homebridge by command line it works fine.
    Some ideas?
    Thanks in advance.

  54. Hi Tim.

    I have constantly crashes with home ridge.
    Can you help me out or give me any advice.

    I created the trouble by installing a third party app from iOS AppStore.
    This app installed homebridge to start up with Init.d I believe…

    But I installed homebridge with systemd.
    Now both are making my install unstable. How do I get rid of the Init.d boot Up?

    I believe that I should keep systemd??

    Hope you can help me!

    Greets marco

      1. Eadrinuse with a number or something.
        And a whole lot of text.
        Also I see in the cpu usage in the top bar (nearby the network logo) a constant returning peak! Every 10 sec. then I see in the task manager homebridge usage going to 25%. And I see to time homebridge process. By 2 usernames. Pi an homebridge.
        So that’s why I concluded it is trying to double start.

  55. pi@hassbian:~ $ sudo useradd –system homebridge
    useradd: user ‘homebridge’ already exists
    pi@hassbian:~ $ sudo mkdir /var/homebridge
    mkdir: cannot create directory ‘/var/homebridge’: File exists
    pi@hassbian:~ $
    pi@hassbian:~ $ sudo cp ~/.homebridge/config.json /var/homebridge/
    pi@hassbian:~ $ sudo cp -r ~/.homebridge/persist /var/homebridge
    pi@hassbian:~ $ sudo chmod -R 0777 /var/homebridge
    pi@hassbian:~ $ sudo systemctl daemon-reload
    pi@hassbian:~ $ sudo systemctl enable homebridge
    Synchronizing state for homebridge.service with sysvinit using update-rc.d…
    Executing /usr/sbin/update-rc.d homebridge defaults
    Executing /usr/sbin/update-rc.d homebridge enable
    pi@hassbian:~ $ sudo systemctl start homebridge
    pi@hassbian:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: active (running) since Sat 2017-11-11 16:01:50 CET; 3min 54s ago
    Main PID: 2233 (homebridge)
    CGroup: /system.slice/homebridge.service
    └─2233 homebridge
    pi@hassbian:~ $

    Yet no success, while all is running. Can’t get the Homebridge going.
    In the homebridge.service also this change: ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS

    So I am confused, why is it that my Homebridge is not running smoothly….

  56. This helped me a lot 🙂

    I had to remove local from: ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS because my homebridge installed in /usr/bin/

  57. I did the setup correct and homebridge is running at startup perfect. But now when i’m trying to install new plugins I get this messeges:

    npm WARN saveError ENOENT: no such file or directory, open ‘/home/pi/package.json’
    npm WARN enoent ENOENT: no such file or directory, open ‘/home/pi/package.json’
    npm WARN pi No description
    npm WARN pi No repository field.
    npm WARN pi No README data
    npm WARN pi No license field.

    + [email protected]
    updated 1 package in 5.023s

    Can anyone help with this ?

  58. Hi,

    I have done all these steps, seem no errors in the logs. The HomeKit app shows them as responding, they seem to think they turn on when they just don’t. Any ideas? It worked before I added it with bootup.

    Thanks!

      1. Hi,

        I was using the Harmony plugin which I think was the reason as it works when I only run the Hue plugin. Thanks for your help though! Happy new year!

  59. I recently added some new “accessories” to the config.json file and the homebridge service is running without errors, but now my phone cannot find the Crekit accessory anymore. Is this still compatible with iOS 11?

      1. Thanks for the confirmation. It works again after I deleted the persist/ directory as suggested in the “Common Issues” section of the homebridge installation readme.

  60. Thank you for your post. It worked perfectly the first time around. If you make sure the folders and files are created in the right location (not just create them and hope they are where they need to be) then the instructions work well and Homebridge starts right up. You just have to take a few extra seconds to ensure the files you create on steps 1 and 2 are created correctly!

    Thank you!

  61. …and can i use user “root” …..
    actually i want to move from init.d to systemd …. init.d is configured with user root 🙁

    Richard

  62. I’m getting the following error. please help.

    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; disabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Tue 2018-01-23 06:32:42 UTC;
    Process: 11201 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILU
    Main PID: 11201 (code=exited, status=1/FAILURE)

    1. update: no longer getting the above error. now getting the below. I’ve followed all the steps and still the boot up isn’t working. help!

      pi@raspberrypi:~ $ sudo systemctl daemon-reload
      pi@raspberrypi:~ $ sudo systemctl enable homebridge
      pi@raspberrypi:~ $ sudo systemctl start homebridge
      pi@raspberrypi:~ $ systemctl status homebridge
      ● homebridge.service – Node.js HomeKit Server
      Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
      Active: active (running) since Tue 2018-01-23 08:03:36 UTC; 2s ago
      Main PID: 3825 (homebridge)
      CGroup: /system.slice/homebridge.service
      ├─3825 homebridge
      ├─3834 /bin/sh -c /bin/echo -n “$(npm -g prefix)/lib/node_modules”
      └─3835 npm

  63. Hi All,
    I hope somebody can help me.
    I have also an issue with starting the Homebridge. This is the outcome-
    â homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Sat 2018-02-03 15:04:57 UTC; 2s ago
    Process: 378 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)
    Main PID: 378 (code=exited, status=203/EXEC)

    Feb 03 15:04:57 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    Feb 03 15:04:57 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.

    Thx Max

  64. Seem to have the same issue over and over:

    homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor prese
    Active: activating (auto-restart) (Result: exit-code) since Mon 2018-02-05 21
    Process: 2620 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, sta
    Main PID: 2620 (code=exited, status=1/FAILURE)

    Feb 05 21:46:48 raspberrypi systemd[1]: homebridge.service: Main process exited,
    Feb 05 21:46:48 raspberrypi systemd[1]: homebridge.service: Unit entered failed
    Feb 05 21:46:48 raspberrypi systemd[1]: homebridge.service: Failed with result ‘
    lines 1-9/9 (END)

  65. Noobee here… Thanks for publishing… After completing my initial Homebridge instill and using your proceedure to run Homebridge after boot, I’ve been swapping out plugins to try to find one that works properly with my Chamberlain garage door opener which has been a challenge. So, I’ve been removing plugins and changing config.json file info accordingly. Do I need to be moving these changes to the files under the homebridge user that was created by following the exact same steps? Seems that I have 2 different instances of homebridge running now based on executing homebridge command from the root user and then running the “systemctl status homebridge” command based on the fact that there are 2 different homekit codes being shown. Your help would be appreciated!

    1. One other point I forgot to mention… I am not able to connect to homebridge from the home app on any of my devices..

    2. Yes I would move them to the config.json file that you moved under the homebridge user. Do they both start when you restart the pi?

      1. Correct. I ran successfully but I can’t connect to homebridge from my ios device. That said, it seems that I have 2 instances of homebridge running at the same time under root and then var/homebridge. So, any changes made need to be moved to the homebridge user folder correct?

          1. So, needed to come back to this issue this morning…
            – So I restarted the rpi3 and logged in.
            – Ran “systemctl status homebridge” command – See below – everything came back as running – gave me key of 031-45-154 to connect my ios devices with
            – changed directory to “/var/homebridge” and ran homebridge command and it came back and gave me a key of 123-45-678

            Would this suggest that my config.json file is screwed up. Not sure how you would get the 2 different keys

            As you can see when I run homebridge command manually from the /var/homebridge director it loads the homebridge-chamberlin plugin and everything seems normal except for the DNS error. Any suggestions?

            ssh session window copy below

            ——————————————————————
            login as: pi
            [email protected]‘s password:
            Linux raspberrypi3 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l

            The programs included with the Debian GNU/Linux system are free software;
            the exact distribution terms for each program are described in the
            individual files in /usr/share/doc/*/copyright.

            Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
            permitted by applicable law.
            Last login: Tue Feb 6 06:19:27 2018 from 10.0.1.107
            pi@raspberrypi3:~ $ systemctl status homebridge
            ● homebridge.service – Node.js HomeKit Server
            Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor prese
            Active: active (running) since Mon 2018-02-05 19:49:49 UTC; 1 day 22h ago
            Main PID: 372 (homebridge)
            CGroup: /system.slice/homebridge.service
            └─372 homebridge

            Feb 05 19:49:55 raspberrypi3 homebridge[372]:
            Feb 05 19:49:55 raspberrypi3 homebridge[372]:
            Feb 05 19:49:55 raspberrypi3 homebridge[372]:
            Feb 05 19:49:55 raspberrypi3 homebridge[372]: Or enter this code with your HomeK
            Feb 05 19:49:55 raspberrypi3 homebridge[372]:
            Feb 05 19:49:55 raspberrypi3 homebridge[372]: ┌────────────┐
            Feb 05 19:49:55 raspberrypi3 homebridge[372]: │ 031-45-154 │
            Feb 05 19:49:55 raspberrypi3 homebridge[372]: └────────────┘
            Feb 05 19:49:55 raspberrypi3 homebridge[372]:
            Feb 05 19:49:55 raspberrypi3 homebridge[372]: [2018-2-5 19:49:55] Homebridge is

            pi@raspberrypi3:~ $ ls
            Desktop Documents Downloads Music oldconffiles Pictures Public python_games Templates Videos
            pi@raspberrypi3:~ $ cd /var/homebridge
            pi@raspberrypi3:/var/homebridge $ ls
            accessories config.json package-lock.json persist
            pi@raspberrypi3:/var/homebridge $ cd /
            pi@raspberrypi3:/ $ cd /var/homebridge
            pi@raspberrypi3:/var/homebridge $ homebridge
            *** WARNING *** The program ‘node’ uses the Apple Bonjour compatibility layer of Avahi.
            *** WARNING *** Please fix your application to use the native API of Avahi!
            *** WARNING *** For more information see
            *** WARNING *** The program ‘node’ called ‘DNSServiceRegister()’ which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
            *** WARNING *** Please fix your application to use the native API of Avahi!
            *** WARNING *** For more information see
            [2018-2-7 18:23:22] Loaded plugin: homebridge-chamberlain
            [2018-2-7 18:23:22] Registering accessory ‘homebridge-chamberlain.Chamberlain’
            [2018-2-7 18:23:22] —
            [2018-2-7 18:23:22] Loaded config.json with 1 accessories and 0 platforms.
            [2018-2-7 18:23:22] —
            [2018-2-7 18:23:22] Loading 1 accessories…
            [2018-2-7 18:23:22] [Garage Door] Initializing Chamberlain accessory…
            Setup Payload:
            X-HM://0023OA632HANI
            Scan this code with your HomeKit app on your iOS device to pair with Homebridge:

            Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:

            ┌────────────┐
            │ 123-45-678 │
            └────────────┘

            /usr/lib/node_modules/homebridge/node_modules/mdns/lib/advertisement.js:56
            dns_sd.DNSServiceRegister(self.serviceRef, flags, ifaceIdx, name,
            ^

            Error: dns service error: name conflict
            at new Advertisement (/usr/lib/node_modules/homebridge/node_modules/mdns/lib/advertisement.js:56:10)
            at Object.create [as createAdvertisement] (/usr/lib/node_modules/homebridge/node_modules/mdns/lib/advertisement.js:64:10)
            at Advertiser.startAdvertising (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Advertiser.js:47:30)
            at Bridge.Accessory._onListening (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:661:20)
            at emitOne (events.js:116:13)
            at HAPServer.emit (events.js:211:7)
            at HAPServer._onListening (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:190:8)
            at emitOne (events.js:116:13)
            at EventedHTTPServer.emit (events.js:211:7)
            at EventedHTTPServer. (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/util/eventedhttp.js:65:10)
            pi@raspberrypi3:/var/homebridge $ ^C

      2. here is what I got when I ran the systemctl command from root

        pi@raspberrypi3:~ $ systemctl status homebridge
        ● homebridge.service – Node.js HomeKit Server
        Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor prese
        Active: active (running) since Mon 2018-02-05 19:49:49 UTC; 10h ago
        Main PID: 372 (homebridge)
        CGroup: /system.slice/homebridge.service
        └─372 homebridge

        Feb 05 19:49:55 raspberrypi3 homebridge[372]:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]: Or enter this code with your HomeK
        Feb 05 19:49:55 raspberrypi3 homebridge[372]:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]: ┌────────────┐
        Feb 05 19:49:55 raspberrypi3 homebridge[372]: │ 031-45-154 │
        Feb 05 19:49:55 raspberrypi3 homebridge[372]: └────────────┘
        Feb 05 19:49:55 raspberrypi3 homebridge[372]:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]: [2018-2-5 19:49:55] Homebridge is
        lines 1-17/17 (END)…skipping…
        ● homebridge.service – Node.js HomeKit Server
        Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
        Active: active (running) since Mon 2018-02-05 19:49:49 UTC; 10h ago
        Main PID: 372 (homebridge)
        CGroup: /system.slice/homebridge.service
        └─372 homebridge

        Feb 05 19:49:55 raspberrypi3 homebridge[372]:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]: Or enter this code with your HomeKit app on your iOS device to
        Feb 05 19:49:55 raspberrypi3 homebridge[372]:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]: ┌────────────┐
        Feb 05 19:49:55 raspberrypi3 homebridge[372]: │ 031-45-154 │
        Feb 05 19:49:55 raspberrypi3 homebridge[372]: └────────────┘
        Feb 05 19:49:55 raspberrypi3 homebridge[372]:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]: [2018-2-5 19:49:55] Homebridge is running on port 34725.
        ~
        ~
        ~
        ~
        ~
        ~
        ~
        ~
        ~
        ~
        ~
        ~
        ~
        ~
        lines 1-17/17 (END)
        ● homebridge.service – Node.js HomeKit Server
        Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
        Active: active (running) since Mon 2018-02-05 19:49:49 UTC; 10h ago
        Main PID: 372 (homebridge)
        CGroup: /system.slice/homebridge.service
        └─372 homebridge

        Feb 05 19:49:55 raspberrypi3 homebridge[372]:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]: Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]: ┌────────────┐
        Feb 05 19:49:55 raspberrypi3 homebridge[372]: │ 031-45-154 │
        Feb 05 19:49:55 raspberrypi3 homebridge[372]: └────────────┘
        Feb 05 19:49:55 raspberrypi3 homebridge[372]:
        Feb 05 19:49:55 raspberrypi3 homebridge[372]: [2018-2-5 19:49:55] Homebridge is running on port 34725.
        ~
        ~
        ~
        ~
        ~
        ~
        ~
        ~
        ~
        ~
        ~
        ~
        ~
        ~

      1. Hey Tim,

        not really … attached you will find a screenshot before and after the cmd_on command of cmdswitch2. As you can see, it starts the mplayer but the mplayer will be closed within a couple of second. Afterwards it looks like the first status report.

        Screenshot: http://awi.myknack.de/cmd.png

        Any idea?

          1. hmm I have chown and chmod the location of the folder which contains the scripts. Do I need any other special settings? When I use homebridge without the service, everything works.

  66. I could really use some help. I am running into issues when this process when I have LiftMaster2 installed along with my Nest. If I do not have the LiftMaster2 plugin installed I am able to get this process working with just the Nest plugin. Here is the error I get when running the systemctl status homebridge command,

    pi@raspberrypi:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Tue 2018-02-13 01:08:15 UTC; 3s ago
    Process: 7086 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 7086 (code=exited, status=1/FAILURE)

    Feb 13 01:08:15 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
    Feb 13 01:08:15 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    Feb 13 01:08:15 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.

    Any help would be greatly appreciated

      1. Hey, im having the exact same issue.
        And yes, it happens when I run “/opt/nodejs/lib/node_modules/homebridge/bin/homebridge”
        I can not run “.homebridge” or simply “homebridge” as stated in EVERY Tutorial…

        Thanks for your help…

        1. I Edited the ExecStart Part to “ExecStart=/opt/nodejs/lib/node_modules/homebridge/bin/homebridge $HOMEBRIDGE_OPTS” which now runs the Homebridge on Startup, now I will need to configure it somehow getting my 433MHz Outlets to run…

          Thank you!

    1. Hello. I was following Tim’s instructions in the article and encountered the same error as you do. The issue could be due to NPM trying to access the .config folder for user homebridge.

      Anyway, you can try the following steps, as it worked for me:

      1) sudo mkdir /home/homebridge
      2) sudo mkdir /home/homebridge/.config
      3) sudo chmod -R 0777 /home/homebridge

      And just to be sure:
      4) sudo chmod -R 0777 /home/homebridge/.config

      After the 4 steps, the homebridge service should run fine. Check your logs again to confirm.

      1. Hey Tim thank you very much for the guide!

        I also had this problem:
        “homebridge.service – Node.js HomeKit Server
        Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
        Active: activating (auto-restart) (Result: exit-code) since Tue 2018-10-02 22:23:30 UTC; 3s ago
        Process: 6131 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
        Main PID: 6131 (code=exited, status=1/FAILURE)”

        and ROZMAIL steps fix it:
        1) sudo mkdir /home/homebridge
        2) sudo mkdir /home/homebridge/.config
        3) sudo chmod -R 0777 /home/homebridge
        4) sudo chmod -R 0777 /home/homebridge/.config

  67. can´t get it to work. need help
    pi@raspberrypi:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Fri 2018-02-16 10:14:18 UTC; 8s ago
    Process: 1103 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)
    Main PID: 1103 (code=exited, status=203/EXEC)

    Feb 16 10:14:18 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.

  68. Hey, great guide and easy to follow. I’m an absolute n00b so please bear that in mind.

    I’ve gone through every step, although at step 5 onwards it appeared nothing was happening, the commands were being entered but it just took me to the next row to enter them in (that might be by design). When I got to the final step to check system status I get the following:

    pi@raspberrypi:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: activating (auto-restart) (Result: exit-code) since Fri 2018-02-16 10:37:44 UTC; 9s ago
    Process: 3778 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)
    Main PID: 3778 (code=exited, status=203/EXEC)

    I’m not sure what this means or how to correct that? Any assistance would be appreciated. Thank you.

    1. Actually, ignore that. I forgot to delete /local/ from step two. For anyone else who is having the same issue, here’s the n00b explanation.

      At step 2, enter ‘sudo nano /etc/systemd/system/homebridge.service’ and the gist you need to paste is below. What I hadn’t done is delete /local/ from ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS but the correct gist below has it removed.

      Thanks for this guide. It works a treat (if you read and understand it properly)

      [Unit]
      Description=Node.js HomeKit Server
      After=syslog.target network-online.target

      [Service]
      Type=simple
      User=homebridge
      EnvironmentFile=/etc/default/homebridge
      ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS
      Restart=on-failure
      RestartSec=10
      KillMode=process

      [Install]
      WantedBy=multi-user.target

  69. I have a similar but even complicated problem. My homebridge was running fine for a year and it stopped working since last week. In my attempt to fix it, upgraded homebridge to a later version, which in turn required me to upgrade node and npm. Now i can get homebridge fully functional when
    pi@hassbian:~ $ homebridge
    however cannot the life of me get it to auto start!

    hint to the problem could be
    pi@hassbian:~ $ which homebridge
    /home/pi/.nvm/versions/node/v4.8.7/bin/homebridge
    Doing same using su
    root@hassbian:/home/pi# which homebridge
    /usr/local/bin/homebridge

    I have tried your steps with
    ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS
    and
    ExecStart=/home/pi/.nvm/versions/node/v4.8.7/bin/homebridge $HOMEBRIDGE_OPTS

    Gets following error
    pi@hassbian:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: activating (auto-restart) (Result: exit-code) since Sat 2018-02-17 23:17:54 ACST; 8s ago
    Process: 1809 ExecStart=/home/pi/.nvm/versions/node/v4.8.7/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 1809 (code=exited, status=1/FAILURE)

  70. I was having the error
    homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Sun 2018-03-04 03:00:13 UTC; 9s ago
    Process: 2158 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)
    Main PID: 2158 (code=exited, status=203/EXEC)

    The fix ware to do is which homebridge and copy the path to the ExecStart
    before:
    ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS
    which homebridge
    /home/pi/.nvm/versions/node/v9.5.0/bin/homebridge
    after:
    ExecStart=/home/pi/.nvm/versions/node/v9.5.0/bin/homebridge $HOMEBRIDGE_OPTS

  71. Ok this might be a stupid question but how do you stop home bridge now? I tried “killall homebridge” command. but does not work anymore. Thanks for great tutorial. Sorry really new at this pi thing.

  72. I really can’t get this to work. Homebridge works just fine when starting manually. But as a service is says it’s running but my harmony plugin does not work, I can flip the switches etc but nothing happens. Really strange.

  73. I had my homebridge all good and working through my raspberry pi (did it all through Putty). after trying this (homebridge start on bootup) it all stopped working. Does not connect at all and gives this error:

    /usr/local/lib/node_modules/homebridge/node_modules/mdns/lib/dns_sd.js:35
    throw ex;
    ^

    Error: Module version mismatch. Expected 48, got 57.
    at Error (native)
    at Object.Module._extensions..node (module.js:568:18)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object. (/usr/local/lib/node_modules/homebridge/node_modules/mdns/lib/dns_sd.js:24:20)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)

    please help. I don’t actually think i need it to start at bootup. if i can’t fix this, how do I delete all of these new directories/rules to not affect homebridge.

    on a related note. I’ve tried resetting my homekit from my iPhone. I now have no accessories connected to homekit. when trying to add homebridge back in (via my macbook, which is still currently working) it says already added. how do I get everything back to working?

    thanks in advance!

  74. Hi thanks for setting up this guide. I’ve come back to it several times and I *did* have a working setup for a while until I installed a new plugin.
    Could you help with an issue I got when installing a plugin? Rather than cross posting, here’s a link to the error output log in case someone else has the issue.
    Error: EACCES: permission denied, mkdir ‘/home/homebridge’

    https://github.com/lprhodes/homebridge-broadlink-rm/issues/284

    Thanks!

  75. Hello guys, I had a different issue which got me a hard work (I’m beginner). I’m posting it in case that would help someone out.
    I did all the instructions above, though I had the following error when checking the status of homebridge:

    pi@raspberrypi:/home $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Fri 2018-03-16 22:54:35 UTC; 2s ago
    Process: 2249 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 2249 (code=exited, status=1/FAILURE)
    Mar 16 22:54:35 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
    Mar 16 22:54:35 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    Mar 16 22:54:35 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.

    When looking at the logs, I had:
    pi@raspberrypi:~ $ tail -100 /var/log/daemon.log
    Mar 16 23:13:22 raspberrypi homebridge[4070]: throw err0;
    Mar 16 23:13:22 raspberrypi homebridge[4070]: ^
    Mar 16 23:13:22 raspberrypi homebridge[4070]: Error: EACCES: permission denied, mkdir ‘/var/lib/homebridge’

    I checked and realized that homebridge was actually in ‘/var’ as instructed in this tutorial. Si I moved it to ‘/var/lib’ with the command:
    sudo mv /var/homebridge /var/lib

    which solved the problem. I hope this will help someone else.

  76. Thanks!!! Finally got it rigged up with helps from these instructions. However I had to completely change the path for homebridge; I used the command “which homebridge” to locate the path, and then just used that result in the line where you mentioned removing “local”.

  77. having trouble getting this to work on my pi. homebridge runs fine when started directly but not with systemd.

    systemctl gives:
    process: 1839 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=excited, status=1/FAILURE)
    MAIN PID: 1839 (code=exited, status=1/FAILURE)

    journalctl seems to throw an error (“the requested platform ‘” + name + “‘ was not registered by any plugin. ‘);

    Not sure what the issue is because it runs fine when started manually. Any help will save my sanity, have spent hours on this already!

  78. hello Tim,
    i followed your tuto and all worked well but suddenly, systemctl is not working anymore and trows the error below:

    npm update check failed │
    Apr 04 21:34:45 raspberrypi homebridge[311]: │ Try running with sudo or get access │
    Apr 04 21:34:45 raspberrypi homebridge[311]: │ to the local update config store via │
    Apr 04 21:34:45 raspberrypi homebridge[311]: │ sudo chown -R $USER:$(id -gn $USER) /home/homebridg/.config

    I followed many discussion about same topic but couldn’t find a solution to my situation :((
    would you mind to give a hand plsssssss
    thx a lot!

      1. Yes, the recent change was to remove 1 plugin that I installed for test purpose. Also NPM was updated.
        I have checked the log journal and saw that the system still tries to look for that plugin and can’t find it as I removed it with NPM remove cmd line and removed as well from config.json. I also emptied the persistence folder and also checked that nothing was in acc.cached folder.
        Now I really stuck :() If any idea, that would be great and potential help others as well 🙂

  79. Hi Tim,
    Could you please let me know how much config file do you have on your system and how many there should be?
    Cuz i have 2 of them as below and not sure if it’s correct or not:
    /var/lib/homebridge/config.json
    /home/pi/.homebridge/config.json
    thx!

  80. Since I have a plugin that requires root privileges, like running “sudo homebridge”, how can I configure for systemctl? I tried giving root privileges to the user “homebridge” by “sudo usermod -a -G sudo homebridge” but it isn’t doing the trick, any suggestions?

  81. Hi Tim,
    Since I have a plugin that requires homebridge to be run with root privileges like “sudo homebridge”, how can I configure for systemctl? I tried by giving root privileges to the user homebridge by “sudo usermod -a -G sudo homebridge” but it is not doing the trick, any suggestions?

  82. I seem to have run through all commands to set up Rpi but can not find acce3ssory in Home App.
    then run below in putty and it shows fails.
    any idea what is wrong?

    pi@raspberrypi:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; disabled; vendor pres
    Active: activating (auto-restart) (Result: exit-code) since Sun 2018-04-08 15
    Process: 827 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited
    Main PID: 827 (code=exited, status=203/EXEC)

    Apr 08 15:39:54 raspberrypi systemd[1]: homebridge.service: Unit entered failed
    Apr 08 15:39:54 raspberrypi systemd[1]: homebridge.service: Failed with result ‘
    lines 1-8/8 (END)
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; disabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Sun 2018-04-08 15:39:54 ACST; 9s ago
    Process: 827 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)
    Main PID: 827 (code=exited, status=203/EXEC)

    Apr 08 15:39:54 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    Apr 08 15:39:54 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.

      1. this was working last year. after a holiday came back to fail. since then have tried averything. from new Pi, to many times reformatting, loading and starting. Why is it saying homebridge.system disabled, when everyone else says enabled?

  83. Hi Tim, I to am a newbie, but was able get through your instructions with no issues. Thank you. Just one question… Where do I go to find the output of the executing homebridge?

    Thanks john

  84. Tim,

    Thanks so much for this tutorial.

    I ran into one issue on Step 9

    Once i entered: sudo systemctl enable homebridge
    I got this response: Failed to enable unit: Invalid argument

    All the commands I entered up to step 9 worked fine.

    Any idea what caused the Invalid Argument? i’m using a newer Rpi with the latest software.
    I have homebridge running well and just wanted it to boot on launch.

    Any help is appreciated. Regards,

  85. Anybody ever tried to save every data from homebridge accessories (temperature, door open/close/ motion) and save them on a sheet or on a server ?

  86. Hello! small question if you don’t mind regarding the point5:

    sudo cp ~/.homebridge/config.json /var/homebridge/

    Does it mean that each time an accessory is added to the ~/.homebridge/config.json file, the config file in /var/homebridge/ has to be updated manually as well??

    Thx!

  87. On reboot the “Smartthings” accessory not working but nest is working.

    after I reboot, if I disable these and enable again then working
    sudo systemctl enable homebridge
    sudo systemctl start homebridge

    any help please?

  88. Everything works great, but when I want to add additional plug ins or update the config.json, do I update both config.json locations or just /var/homebridge? Do I add plugins the normal way (i.e. npm – g install homebridge-plugin)? Thanks

  89. I’m a total NOOB when it comes to this stuff, but hopefully you can help me figure out what’s wrong… I’m getting some errors… It’s failing “with result ‘exit-code'”

    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Sun 2018-04-22 19:51:23 PDT; 6s ago
    Process: 11501 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 11501 (code=exited, status=1/FAILURE)

    Apr 22 19:51:23 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    Apr 22 19:51:23 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’

    Any chance you would have any advice?

      1. Thank you! I tried deleting the user entirely after attempting to fix the permissions, but it may not have worked all the way because when I got down to step 4 it said it existed… Anyway, I was able to remove the folder completely and start again from there. My last resort was to completely wipe the SD card and start from scratch… Luckily it didn’t have to come to that.

  90. I am having issues with getting this fully working. The steps above get homebridge to start on reboot, I get the following from the systemctl status:

    $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: active (running) since Fri 2018-04-27 21:20:05 UTC; 4s ago
    Main PID: 2155 (homebridge)
    CGroup: /system.slice/homebridge.service
    └─2155 homebridge

    So all looks fine, but within Homekit all devices state “Not Responding”. However if I run:

    sudo systemctl stop homebridge

    then just run homebridge manually from the terminal then the devices in Homekit all work as expected.

    Any ideas on what the issue may be?

      1. Thanks Tim, I have figured it out. The setup was correct following your guide above, the issue I had was in my config.json file. Specifically with syntax in the accessory section. I had a rogue character that once removed, I rebooted and all worked fine as expected.

  91. I followed your guide but bI’m getting this error when I check the status of the service. What have I done wrong?

    [pi@raspberrypi:~ $ systemctl status homebridge

    ● homebridge.service – Node.js HomeKit Server

    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)

    Active: activating (auto-restart) (Result: exit-code) since Thu 2018-05-03 17:49:23 BST; 8s ago

    Process: 592 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)

    Main PID: 592 (code=exited, status=203/EXEC)

    May 03 17:49:23 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.

    May 03 17:49:23 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’

      1. Thanks for the reply the Tim. I managed to solve the problem shortly after posting, it turned out I had to remove ‘local’ from the gist info at Step 2 – ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS

        Once I’d done that and re-ran the commands in Steps 8-10 the service started perfectly and has ran ever since.

        Thanks for the great and simple guide from someone with no previous linux experience.

  92. hi Tim,

    Followed your instructions. I am not sure on step 2.1; My homebridge was by default installed under /home/pi/.homebridge (at least that’s where the config.json shows up) but when I changed
    ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS to ExecStart=/home/pi/.homebridge something goes wrong at the end. I was expecting this to be wrong but what is the correct path?
    regards,
    Paul

      1. Yup, I already tried that but that did not solve it unfortunately. I am still trying to find out which directory should be filled in on the ExecStart line. In my /usr/bin (or even /usr/) I don’t have a homebridge directory. The location where the config.json shows up is /home/pi/.homebridge but I already understood that the home directory cannot be used for services.

        Sorry, Linux noob reporting 🙁

  93. hi Tim,
    i am getting this error, after manual running of home-bridge after adding Fibaro plug in… please give me solution

    pi@raspberrypi:~ $ homebridge
    [5/6/2018, 6:23:25 PM] Plugin /usr/local/lib/node_modules/homebridge-fibaro-hc2 requires Node version of >7.0.0 which does not satisfy the current Node version of v4.7.0. You may need to upgrade your installation of Node.
    [5/6/2018, 6:23:28 PM] Loaded plugin: homebridge-fibaro-hc2
    [5/6/2018, 6:23:28 PM] Registering platform ‘homebridge-fibaro-hc2.FibaroHC2’
    [5/6/2018, 6:23:28 PM] —
    [5/6/2018, 6:23:28 PM] There was a problem reading your config.json file.
    [5/6/2018, 6:23:28 PM] Please try pasting your config.json file here to validate it: http://jsonlint.com
    [5/6/2018, 6:23:28 PM]
    /usr/local/lib/node_modules/homebridge/lib/server.js:207
    throw err;
    ^

    SyntaxError: Unexpected token “
    at Object.parse (native)
    at Server.str.replace.Server._loadConfig (/usr/local/lib/node_modules/homebridge/lib/server.js:201:19)
    at new Server (/usr/local/lib/node_modules/homebridge/lib/server.js:57:38)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:26:16)
    at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)

  94. Hi Tim,
    thanks for the guide. Unfortunately, I had some troubles running homebridge at the startup when I finally realize where was the mistake: the right path in the steps 4, 5, 6 and 7 (at least for me) is /var/lib/homebridge/ and not /var/homebridge.
    After I created the folder, moved the file and assign the right permissions I got HomeBridge to start.
    I hope that will help other users.

  95. Hi there, I am really new to this as well, but I can’t get pass the adding the device bit. I added my Homebridge to the iOS Home app but it say:
    “Additional setup required. Add related accessories with home assistant in the manufacturer’s app”
    I tried looking on the Nest app with no luck, also tried using apps such as Insteon+ and Ezzi Home but they can’t find any new devices, although Ezzi Home did find my Homebridge, but I don’t see any options to get it working, just that Homebridge is running and the version history. Anyone got any ideas?
    Thanks!

  96. My Soma smart shades plugin is not working under systemctl start homebridge but works when I start Homebridge manually. It uses control.py. Any ideas what I can do?

    1. Usually, this is a file or folder permission issue. Make sure the homebridge user has the correct permissions to access the folders it needs for the application.

  97. Hello there, thanks for the tutorial! I have a little problem, every time I boot the Raspberry home bridge starts without any problem but it keeps asking me to push the link button on the bridge in order to create a user! If I do, it all starts perfectly. How can I solve this problem? Thanks 🙂

  98. I total noob on this, but I’m gettin this error – Process: 1739 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Any help?
    Thanks

  99. Thanks Tim,

    Followed your instruction and all is good now. Thanks for a detailed and well-explained how-to.

    Cheers,

  100. Hey Tim,

    Great write up for people that don’t care too much about what each step does. You may want to include a section on accessing the log remotely. The command is mentioned in your homebridge file. Mentioning that you can enable extended logging might be a good idea too.

    The command is:

    journalctl -f -u homebridge

    or

    journalctl -f -au homebridge

    For live logging.

    This gives you a whole bunch more information than systemctl status and also the QR code for homebridge.

  101. Hi, I have this working just fine for a LED strip on Homebridge. I since have added CMDSwitch2 for ps4-waker and even though my config containing ps4-waker has copied over; it does not boot the CMDSwitch2 plugin or even appear to try to. It only boots my original plugin from when I first did this (no errors either). What step an I missing for adding new plugins to this? The plugin registers through the normal Homebridge execution, although errors due to the port already being used by this method of running Homebridge. Thanks in advance.

    1. The only thing I can think of is you are editing the wrong config.json. Make sure you add new plugins to the config.json in /var/homebridge/

  102. I have a problem. Autostart worked great for a few days, now it stopped. When I turn off the raspberry and hook up to the electricity, it does not start itself. It only starts when I enter the command: homebridge. Any solution how to fix it? 🙁

  103. Work 3 days, and now stop working. I have this 🙁 :

    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor prese
    Active: activating (auto-restart) (Result: exit-code) since Sun 2018-07-08 21
    Process: 1389 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exite
    Main PID: 1389 (code=exited, status=1/FAILURE)

    lip 08 21:12:31 raspberrypi systemd[1]: homebridge.service: Main process exited,
    lip 08 21:12:31 raspberrypi systemd[1]: homebridge.service: Unit entered failed
    lip 08 21:12:31 raspberrypi systemd[1]: homebridge.service: Failed with result

  104. I’m a noob when it comes to Raspberry Pi and Homebridge. This tutorial was so simple and worked perfectly for me. Thank you!

  105. Hi Tim,

    It took me awhile to realize that I was writing to the wrong config file which made me wonder…

    Is there any way to delete the original homebridge? Any reason not to delete it?

    Thanks,

    Robert

  106. Hey Tim!
    I need your help! If I start homebridge from you tutorial, the live stream from camera do not work-loading; snapshot is working fine and refresh after 10s, also other sonoff and netatmo plugin works. Everything works, just live stream not if I enable auto boot.
    But if stop systemctl homebridge and start homebridge manually-just type homebridge, the live stream from camera works perfect. But with no auto boot.
    Any idea how to fix it?

    Regards W

    1. Possibly a permission error. Does the livestream need access to files or folders. Try giving them permission from the homebridge user.

  107. Hello Tim everything was working fantastic until the electricity turn off for 30 mins !
    Homebridge not working anymore

    events.js:183
    throw er; // Unhandled ‘error’ event
    ^

    Error: listen EADDRINUSE :::51826
    at Object._errnoException (util.js:992:11)
    at _exceptionWithHostPort (util.js:1014:20)
    at Server.setupListenHandle [as _listen2] (net.js:1355:14)
    at listenInCluster (net.js:1396:12)
    at Server.listen (net.js:1480:7)
    at EventedHTTPServer.listen (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/util/eventedhttp.js:60:19)
    at HAPServer.listen (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:158:20)
    at Bridge.Accessory.publish (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:607:16)
    at Server._publish (/usr/lib/node_modules/homebridge/lib/server.js:127:16)
    at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:96:10)

    How can I fix it ?

  108. Hi Tim,

    I ended up on your blog following links from the official repo and successfully installed my home bridge as a service on my raspberry pi zero W so thanks for taking the time to write all the instructions down.

    I would fix one thing though.
    Step 7: sudo chmod -R 0777 /var/homebridge

    This is a terrible security practice and should not be encouraged.
    config.json in this folder is a sensitive file as it will most probably contains password or tokens to access different accessories.
    This step makes the whole folder readable, writable and executable by any accounts on your machine.

    The only user that needs to be able to read this file & folder is `homebridge`.
    So instead you should change this step for:
    `sudo chown -R homebridge:homebridge /var/homebridge` && `sudo chmod 0750 /var/homebridge/config.json`

  109. Hey,

    Hello, a really great contribution. Far as I have never come to me.

    Unfortunately I still have a small problem with [Sensor] i2cOpen: Permission denied. I use the Homebridge with a BME680 sensor. It works with manual startup via “Homebridge”.

    pi @ raspberrypi: ~ $ homebridge
    [2018-8-22 17:50:08] Loaded config.json with 1 accessories and 0 platforms.
    [2018-8-22 17:50:08] —
    [2018-8-22 17:50:12] Loaded plugin: homebridge-bme680
    [2018-8-22 17:50:13] Registering accessory ‘homebridge-bme680.BME680’
    [2018-8-22 17:50:13] —
    [2018-8-22 17:50:13] Loading 0 platforms …
    [2018-8-22 17:50:13] Loading 1 accessories …
    [2018-8-22 17:50:13] [Sensor] Initializing BME680 accessory …
    [2018-8-22 17:50:13] [Sensor] Compensations: -0.35 C, 4% RH
    [2018-8-22 17:50:13] [Sensor] temp & hum names: Temperature, Humidity
    [2018-8-22 17:50:13] [Sensor] bme680 sensor options: {}
    [2018-8-22 17:50:13] [Sensor] init bme680 sensor …
    [2018-8-22 17:50:13] [sensor] initialized bme680 sensor
    [2018-8-22 17:50:13] [sensor] / home / pi
                                                         
        ┌────────────┐
        │ 031-45-154 │
        └────────────┘
                           
    [2018-8-22 17:50:14] Homebridge is running on port 51826.
    [2018-8-22 17:50:14] [Sensor] scheduled history update in 9 min, 46 sec
    [2018-8-22 17:50:14] [sensor] iaq: 1 good
    [2018-8-22 17:50:14] [Sensor] ERROR: bsec_bme680 does not run without errors, ensure that bsec_iaq.config is in the homebrew storagePath (eg ~ ./homebridge) and the directory is writable
    [2018-8-22 17:50:14] [sensor] bsec_iaq.state empty

    [2018-8-22 17:51:10] [sensor] last: 25.74 (raw: 26.15, comp: 25.8) C, 46.28 (raw: 42.09, comp: 46.09)% RH, 577.5 ppm, IAQ: 25 IAQ, IAQ accuray: 0

    The following problem occurs ——–>

    pi @ raspberrypi: ~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
       Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
       Active: active (running) since Wed 2018-08-22 17:44:40 CEST; 18s ago
     Main PID: 2779 (homebridge)
       CGroup: /system.slice/homebridge.service
               └─2779 homebridge

    Aug 22 17:44:56 raspberrypi homebridge [2779]:
    Aug 22 17:44:56 raspberrypi homebridge [2779]: Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:
    Aug 22 17:44:56 raspberrypi homebridge [2779]:
    Aug 22 17:44:56 raspberrypi homebridge [2779]: ┌────────┐
    Aug 22 17:44:56 raspberrypi homebridge [2779]: │ 031-45-154 │
    Aug 22 17:44:56 raspberrypi homebridge [2779]: └────────┘
    Aug 22 17:44:56 raspberrypi homebridge [2779]:
    Aug 22 17:44:56 raspberrypi homebridge [2779]: [2018-8-22 17:44:56] Homebridge is running on port 51826.
    Aug 22 17:44:56 raspberrypi homebridge [2779]: [2018-8-22 17:44:56] [sensor] ERROR: bsec_bme680 does not run without errors, ensure that
    Aug 22 17:44:56 raspberrypi homebridge [2779]: [2018-8-22 17:44:56] [sensor] i2cOpen: Permission denied

  110. Hello,
    I have a problem

    when the service loads auto it says 0 devices found and should check API key.
    when i start it manualy from pi@raspberrypi:~ $ homebridge is starts ok.

    both paths
    manual homebridge start config: /home/pi/.homebridge
    service homebridge start config: /var/homebridge

    have the same config.json

      1. Thank you for the reply.

        the var\homebridge folder is set to everyone.
        do i have to set the following also to everyone?

        sudo nano /etc/default/homebridge
        sudo nano /etc/systemd/system/homebridge.service

        Vasilis

  111. Hi
    first: great help! thanks for the detail and above all for being there!!!!

    I have Homebridge running, several accessories (the UI platform, the sensible and weather plus)…
    I followed the instructions… but still there is something not well…
    The UI console is running, but the Homebridge service is not…

    So I tried to start the service manually
    I then try to run “sudo systemctl start homebridge”… but nothing happens…
    BUT if I write
    “sudo systemctl restart homebridge” THEN the service starts….

    Do you have a tip please?

  112. Hi Tim,
    thanks for coming back to me!
    here is what I see after a reboot

    —>>> sudo systemctl status homebridge brings
    homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: active (running) since Sun 2018-09-02 21:59:22 CEST; 1min 23s ago
    Main PID: 300 (homebridge)
    CGroup: /system.slice/homebridge.service
    ├─300 homebridge
    ├─867 homebridge-config-ui-x
    ├─953 sudo -n journalctl -o cat -n 500 -f -u homebridge
    └─958 journalctl -o cat -n 500 -f -u homebridge

    Sep 02 21:59:31 raspberrypi homebridge[300]: [9/2/2018, 9:59:31 PM] [WeatherPlus] Error retrieving rain
    Sep 02 21:59:31 raspberrypi homebridge[300]: [9/2/2018, 9:59:31 PM] [WeatherPlus] Error Message: Foreca
    Sep 02 21:59:31 raspberrypi homebridge[300]: [9/2/2018, 9:59:31 PM] [WeatherPlus] Error retrieving rain
    Sep 02 21:59:31 raspberrypi homebridge[300]: [9/2/2018, 9:59:31 PM] [WeatherPlus] Error Message: Foreca
    Sep 02 21:59:31 raspberrypi homebridge[300]: [9/2/2018, 9:59:31 PM] [WeatherPlus] Error retrieving weat
    Sep 02 21:59:31 raspberrypi homebridge[300]: [9/2/2018, 9:59:31 PM] [WeatherPlus] Error Message: Foreca
    Sep 02 21:59:35 raspberrypi homebridge[300]: [9/2/2018, 9:59:35 PM] [Config] Using Form Authentication
    Sep 02 21:59:35 raspberrypi homebridge[300]: [9/2/2018, 9:59:35 PM] [Config] Console v3.8.9 is listenin
    Sep 02 21:59:37 raspberrypi sudo[953]: homebridge : TTY=pts/0 ; PWD=/var/homebridge ; USER=root ; COMMA
    Sep 02 21:59:37 raspberrypi sudo[953]: pam_unix(sudo:session): session opened for user root by (uid=0)
    ~
    ~
    ~
    Then I enter “sudo systemctl start homebridge”
    (no errors)
    and the status brings
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: active (running) since Sun 2018-09-02 21:59:22 CEST; 6min ago
    Main PID: 300 (homebridge)
    CGroup: /system.slice/homebridge.service
    ├─ 300 homebridge
    ├─ 867 homebridge-config-ui-x
    ├─1035 sudo -n journalctl -o cat -n 500 -f -u homebridge
    └─1040 journalctl -o cat -n 500 -f -u homebridge

    Sep 02 22:01:11 raspberrypi sudo[1006]: pam_unix(sudo:session): session opened for user root by (uid=0)
    Sep 02 22:01:11 raspberrypi sudo[1006]: pam_unix(sudo:session): session closed for user root
    Sep 02 22:01:11 raspberrypi sudo[1017]: homebridge : TTY=pts/0 ; PWD=/var/homebridge ; USER=root ; COMM
    Sep 02 22:01:11 raspberrypi sudo[1017]: pam_unix(sudo:session): session opened for user root by (uid=0)
    Sep 02 22:01:14 raspberrypi sudo[1017]: pam_unix(sudo:session): session closed for user root
    Sep 02 22:01:14 raspberrypi sudo[1024]: homebridge : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/kil
    Sep 02 22:01:14 raspberrypi sudo[1024]: pam_unix(sudo:session): session opened for user root by (uid=0)
    Sep 02 22:01:14 raspberrypi sudo[1024]: pam_unix(sudo:session): session closed for user root
    Sep 02 22:01:19 raspberrypi sudo[1035]: homebridge : TTY=pts/0 ; PWD=/var/homebridge ; USER=root ; COMM
    Sep 02 22:01:19 raspberrypi sudo[1035]: pam_unix(sudo:session): session opened for user root by (uid=0)

  113. Hi Tim,
    ah…the Pi is on wireless…
    so here is what I did:
    1) reboot PI through VNC
    2) when the PI was up — I checked the Wifi was on
    —> still homebridge was not running

    3) stop homebridge
    4) start homebridge
    —> all there….

    So… when VNC was up, WiFi was up of course…. and till then homebridge could have tried to start and Internet was not there….
    How do I check this?

    BUT
    (sorry for my lack of understanding)…
    a) if a service fails to load eg DarkSky (weather) would Homebridge still not load and be up, just without the service?

    and
    b) in the restart on boot… even if it did not start because of DarkSky not being reachable….. would it not try again to start?

    many many thanks
    Luis

  114. Thanks so much for posting this! I’ve followed all instructions and doesn’t look like I have any errors. The Apple Home app cannot see my hub automatically or when I type in the code. What am I doing wrong?

    1. I use the EVE app as a middle man. Download EVE on Apple device and add Homebridge.

      @TIM Works like a charm. Thanks man!

  115. Hi Tim,
    I followed your instructions and here’s what I’m getting:

    * homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Sun 2018-10-07 11:30:17 CEST; 8s ago
    Process: 1593 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)
    Main PID: 1593 (code=exited, status=203/EXEC)

    Oct 07 11:30:17 AnsariHome systemd[1]: homebridge.service: Unit entered failed state.
    Oct 07 11:30:17 AnsariHome systemd[1]: homebridge.service: Failed with result ‘exit-code’.

    Any tips?

    1. Does it work when you manually run it? The most common reason people have issues is folder and file permission errors. Double check the user running homebridge has access to the folders it needs.

      1. Hi Tim,

        Thanks for responding. I sorted my mistake out in the meantime. I had to remove local from the /usr/bin path following your instructions, which I had initially overlooked. After that, everything worked perfectly.

        Thanks a lot for putting this together.

  116. Thanks for your guide, it helped with a lot issues which I hand with the original guide.
    I ran in another issue, which is now solved. After setting up homebridge manual the first time to check that everything was running fine I then followed your steps and although the logs showed everything worked fine the Home App said “no response”. After reading a tip from the user stevenguh in the comments of the original thread it seems that if you have any accessory which uses GPIO to read data the permissions of the user homebridge are not sufficient. I had to delete the line User=homebridge in the homebridge.service, restart the device and now everything works fine. (The device I am using is this air-quality thingy https://luftdaten.info/en/home-en/)

  117. Hello, I have all done. then it wa working. sometimes it runs not, I have restart, then works again. today, I change something on config.json, but the code is right. but now home bridges works not more, I have many try, but nothing works 🙁

    here this is the output when I start with: sudo systemctl restart homebridge

    Okt 10 18:05:26 raspberrypi systemd[1]: Started Node.js HomeKit Server.
    Okt 10 18:05:32 raspberrypi homebridge[1304]: [10.10.2018, 18:05:32] Loaded config.json with 8 accessories and 2 platforms.
    Okt 10 18:05:32 raspberrypi homebridge[1304]: [10.10.2018, 18:05:32] —
    Okt 10 18:05:33 raspberrypi homebridge[1304]: [10.10.2018, 18:05:33] Loaded plugin: homebridge-ewelink
    Okt 10 18:05:33 raspberrypi homebridge[1304]: homebridge API version: 2.2
    Okt 10 18:05:33 raspberrypi homebridge[1304]: [10.10.2018, 18:05:33] Registering platform ‘homebridge-eWeLink.eWeLink’
    Okt 10 18:05:33 raspberrypi homebridge[1304]: [10.10.2018, 18:05:33] —
    Okt 10 18:05:33 raspberrypi homebridge[1304]: [10.10.2018, 18:05:33] Loaded plugin: homebridge-samsung-remote
    Okt 10 18:05:33 raspberrypi homebridge[1304]: [10.10.2018, 18:05:33] Registering accessory ‘homebridge-samsung-remote.SamsungTV’
    Okt 10 18:05:33 raspberrypi homebridge[1304]: [10.10.2018, 18:05:33] —
    Okt 10 18:05:33 raspberrypi homebridge[1304]: [10.10.2018, 18:05:33] Loaded plugin: homebridge-wakeonlan
    Okt 10 18:05:33 raspberrypi homebridge[1304]: [10.10.2018, 18:05:33] Registering accessory ‘homebridge-wakeonlan.WakeOnLan’
    Okt 10 18:05:33 raspberrypi homebridge[1304]: [10.10.2018, 18:05:33] —
    Okt 10 18:05:34 raspberrypi homebridge[1304]: [10.10.2018, 18:05:34] Loaded plugin: homebridge-tplink-smarthome
    Okt 10 18:05:34 raspberrypi homebridge[1304]: [10.10.2018, 18:05:34] Registering platform ‘homebridge-tplink-smarthome.TplinkSmarthome’
    Okt 10 18:05:34 raspberrypi homebridge[1304]: [10.10.2018, 18:05:34] —
    Okt 10 18:05:34 raspberrypi homebridge[1304]: [10.10.2018, 18:05:34] Loading 2 platforms…
    Okt 10 18:05:34 raspberrypi homebridge[1304]: [10.10.2018, 18:05:34] [eWeLink] Initializing eWeLink platform…
    Okt 10 18:05:34 raspberrypi homebridge[1304]: [10.10.2018, 18:05:34] [eWeLink] Intialising eWeLink
    Okt 10 18:05:34 raspberrypi homebridge[1304]: [10.10.2018, 18:05:34] [TplinkSmarthome] Initializing TplinkSmarthome platform…
    Okt 10 18:05:34 raspberrypi homebridge[1304]: [10.10.2018, 18:05:34] [TplinkSmarthome] homebridge-tplink-smarthome v3.11.0, node v8.11.1, homebridge v0.4.45
    Okt 10 18:05:34 raspberrypi homebridge[1304]: [10.10.2018, 18:05:34] Loading 8 accessories…
    Okt 10 18:05:34 raspberrypi homebridge[1304]: [10.10.2018, 18:05:34] [SamsungTV] Initializing WakeOnLan accessory…
    Okt 10 18:05:34 raspberrypi homebridge[1304]: [10.10.2018, 18:05:34] [Fernseher] Initializing SamsungTV accessory…
    Okt 10 18:05:34 raspberrypi homebridge[1304]: [10.10.2018, 18:05:34] [Stumm] Initializing SamsungTV accessory…
    Okt 10 18:05:34 raspberrypi homebridge[1304]: [10.10.2018, 18:05:34] [ARD] Initializing SamsungTV accessory…
    Okt 10 18:05:34 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
    Okt 10 18:05:34 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    Okt 10 18:05:34 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.
    Okt 10 18:05:37 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.

    Please can you help me, I don’t know how is the problem.

  118. Please can you help me.

    pi@raspberrypi:/root/.homebridge $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: inactive (dead) (Result: exit-code) since Sun 2018-10-14 10:52:34 CEST; 1min 38s ago
    Process: 27629 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 27629 (code=exited, status=1/FAILURE)

    Okt 14 10:52:26 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1
    Okt 14 10:52:26 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    Okt 14 10:52:26 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.
    Okt 14 10:52:34 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.

  119. Hi! i have got this output during the check of the homebridge status with the command “systemctl status homebridge”.
    ines 1-9/9 (END)…skipping…
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Tue 2018-10-16 21:47:32 CEST; 8s ago
    Process: 2019 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 2019 (code=exited, status=1/FAILURE)

    ott 16 21:47:32 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
    ott 16 21:47:32 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    ott 16 21:47:32 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.

  120. Hi, i get this error running homberidge after setting up everything. how can i fix it? thanks

    RUNNING: journalctl -f -u homebridge
    ott 21 17:02:46 raspberrypi systemd[1]: Started Node.js HomeKit Server.
    ott 21 17:02:49 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
    ott 21 17:02:49 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    ott 21 17:02:49 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.
    ott 21 17:03:00 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
    ott 21 17:03:00 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.

    RUNNING: systemctl status homebridge
    homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor prese
    Active: activating (auto-restart) (Result: exit-code) since Sun 2018-10-21 17
    Process: 1566 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, sta
    Main PID: 1566 (code=exited, status=1/FAILURE)

    ott 21 17:02:49 raspberrypi systemd[1]: homebridge.service: Main process exited,
    ott 21 17:02:49 raspberrypi systemd[1]: homebridge.service: Unit entered failed
    ott 21 17:02:49 raspberrypi systemd[1]: homebridge.service: Failed with result ‘

  121. I have been trying unsuccessfully for the past 2 days to get this working and I must be missing something vital.
    Homebridge launches successfully from Terminal and when I follow the instructions, it launches successfully using the command “sudo systemctl start homebridge” in step 10.
    When I use command “systemctl status homebridge” it looks like everything is OK…
    BUT when I power cycle the Raspberry Pi, the program does not restart and all accessories show “No Response”.
    Please help.

    pi@raspberrypi:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: active (running) since Thu 2018-11-01 20:09:49 UTC; 15s ago
    Main PID: 629 (homebridge)
    CGroup: /system.slice/homebridge.service
    └─629 homebridge

    Nov 01 20:09:55 raspberrypi homebridge[629]:
    Nov 01 20:09:55 raspberrypi homebridge[629]:
    Nov 01 20:09:55 raspberrypi homebridge[629]:
    Nov 01 20:09:55 raspberrypi homebridge[629]: Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:
    Nov 01 20:09:55 raspberrypi homebridge[629]:
    Nov 01 20:09:55 raspberrypi homebridge[629]: ┌────────────┐
    Nov 01 20:09:55 raspberrypi homebridge[629]: │ 987-65-432 │
    Nov 01 20:09:55 raspberrypi homebridge[629]: └────────────┘
    Nov 01 20:09:55 raspberrypi homebridge[629]:
    Nov 01 20:09:55 raspberrypi homebridge[629]: [2018-11-1 20:09:55] Homebridge is running on port 33607.

  122. Hi,
    I followed your instruction and Im able to run homebrigde manually, but when starting systemctl its becoming inactive after few seconds. What could be the probelm?

          1. Yes, First I setup everything manually and it worked with home app. Next I tried to make it starting automatically and then doing:
            sudo systemctl daemon-reload
            sudo systemctl enable homebridge
            sudo systemctl start homebridge
            status says:
            ————
            systemctl status homebridge
            ● homebridge.service – Node.js HomeKit Server
            Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor prese
            Active: active (running) since Sat 2018-12-01 17:05:12 GMT; 2s ago
            Main PID: 724 (homebridge)
            CGroup: /system.slice/homebridge.service
            └─724 homebridge

            Dec 01 17:05:12 raspberrypi systemd[1]: Started Node.js HomeKit Server.
            lines 1-8/8 (END)
            ————
            and then after few seconds later:
            ————
            systemctl status homebridge
            ● homebridge.service – Node.js HomeKit Server
            Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor prese
            Active: inactive (dead) since Sat 2018-12-01 17:05:23 GMT; 9s ago
            Process: 724 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited
            Main PID: 724 (code=exited, status=0/SUCCESS)

            Dec 01 17:05:12 raspberrypi systemd[1]: Started Node.js HomeKit Server.
            Dec 01 17:05:23 raspberrypi homebridge[724]: Usage: homebridge [options]
            Dec 01 17:05:23 raspberrypi homebridge[724]: Options:
            Dec 01 17:05:23 raspberrypi homebridge[724]: -h, –help
            lines 1-10/10 (END)
            ————

      1. I dont think its a json problem, I validated it on jsonlint.com
        —–
        {
        “bridge”: {
        “name”: “PiHomebridge”,
        “username”: “CC:22:3D:E3:CE:41”,
        “port”: 51826,
        “pin”: “031-45-154”
        },

        “description”: “HomePi Homebridge.”,

        “platforms”: [{
        “platform”: “MiPhilipsLightPlatform”,
        “deviceCfgs”: [{
        “type”: “MiPhilipsSmartBulb”,
        “ip”: “192.168.0.152”,
        “token”: “TOKEN_ID”,
        “lightName”: “Living Room Floor Lamp”,
        “lightDisable”: false
        }]
        }]
        }
        —–

  123. In the gist they are using `HOMEBRIDGE_OPTS=-U /var/lib/homebridge`. Regarding to `var/lib/homebridge` you have switched to use `var/homebridge` without any note in your article.

    This could cause some problems if people mix up your and the gists sources. Maybe a hint is a good idea?

    Thanks for your content and great troubleshooting guide.

  124. Hi thank you so much for doing this, could i get a little help? i followed the instructions, and while homebridge starts for me when running it interactively, it does not start by systemd. here is the output of my logs:

    Dec 23 01:35:00 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
    Dec 23 01:35:00 raspberrypi systemd[1]: Started Node.js HomeKit Server.
    Dec 23 01:35:02 raspberrypi homebridge[2141]: [2018-12-23 01:35:02] Loaded config.json with
    0 accessories and 1 platforms.
    Dec 23 01:35:02 raspberrypi homebridge[2141]: [2018-12-23 01:35:02] —
    Dec 23 01:35:02 raspberrypi homebridge[2141]: [2018-12-23 01:35:02] Loaded plugin: homebrid
    ge-harmonyhub
    Dec 23 01:35:03 raspberrypi homebridge[2141]: [2018-12-23 01:35:03] Registering platform ‘h
    omebridge-harmonyhub.HarmonyHub’
    Dec 23 01:35:03 raspberrypi homebridge[2141]: [2018-12-23 01:35:03] —
    Dec 23 01:35:03 raspberrypi homebridge[2141]: [2018-12-23 01:35:03] Loading 1 platforms…
    Dec 23 01:35:03 raspberrypi homebridge[2141]: [2018-12-23 01:35:03] [Harmony Hub] Initializ
    ing HarmonyHub platform…
    Dec 23 01:35:03 raspberrypi homebridge[2141]: Sun, 23 Dec 2018 01:35:03 GMT harmonyhubjs:di
    scover:explorer Explorer(61991)
    Dec 23 01:35:03 raspberrypi homebridge[2141]: Sun, 23 Dec 2018 01:35:03 GMT harmonyhubjs:di
    scover:ping Ping(61991, {})
    Dec 23 01:35:03 raspberrypi homebridge[2141]: Sun, 23 Dec 2018 01:35:03 GMT harmonyhubjs:di
    scover:explorer start()
    Dec 23 01:35:03 raspberrypi homebridge[2141]: Sun, 23 Dec 2018 01:35:03 GMT harmonyhubjs:di
    scover:responsecollector ResponseCollector(61991)
    Dec 23 01:35:03 raspberrypi homebridge[2141]: Sun, 23 Dec 2018 01:35:03 GMT harmonyhubjs:di
    scover:responsecollector start()
    Dec 23 01:35:03 raspberrypi homebridge[2141]: Sun, 23 Dec 2018 01:35:03 GMT harmonyhubjs:di
    scover:ping start()
    Dec 23 01:35:03 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exite
    d, status=1/FAILURE
    Dec 23 01:35:03 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    Dec 23 01:35:03 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.
    Dec 23 01:35:13 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart

  125. Dear Tim,

    Thank you for this guide. Seems like all runs fine but I have three questions:

    1. on reboot I don’t get a terminal in which I can see what homebridge is doing. Is there (Like screen) a possibility to re-attach?

    2. there is a config.json in pi/.homebridge as well as in var/homebridge (it is copied during the tutorial) I should use the second one when I want to update my accessories and platforms right? Can I remove the first one?

    3. When I end the service bij “systemctl stop homebridge” and I type Homebridge, home bridge reads from that first config.json (in pi/.homebridge) is that correct?

    Thank you in advance

    1. Great! No there isn’t a terminal command that I know of. I would make all changes in the bar/homebridge confit file. I think everything should read from the var/homebridge config

  126. Tim,

    I wanted to thank you for your great post on how to start homebridge on boot. Very thorough and accurate. It would have worked on the first try had I not skipped a step. When I corrected that error, it worked flawlessly.

  127. Hello

    I’ve got this issue when I run start on boot

    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: active (running) since Sat 2019-01-05 14:07:41 GMT; 4min 12s ago
    Main PID: 340 (homebridge)
    CGroup: /system.slice/homebridge.service
    └─340 homebridge

    Jan 05 14:07:45 raspberrypi homebridge[340]: [1/5/2019, 2:07:45 PM] —
    Jan 05 14:07:46 raspberrypi homebridge[340]: [1/5/2019, 2:07:46 PM] Loaded plugin: homebridge-tahoma
    Jan 05 14:07:46 raspberrypi homebridge[340]: homebridge-tahoma API version: 2.2
    Jan 05 14:07:46 raspberrypi homebridge[340]: [1/5/2019, 2:07:46 PM] Registering platform ‘homebridge-tahoma.Tahoma’
    Jan 05 14:07:46 raspberrypi homebridge[340]: [1/5/2019, 2:07:46 PM] —
    Jan 05 14:07:46 raspberrypi homebridge[340]: [1/5/2019, 2:07:46 PM] Loading 1 platforms…
    Jan 05 14:07:46 raspberrypi homebridge[340]: [1/5/2019, 2:07:46 PM] [Tahoma] Initializing Tahoma platform…
    Jan 05 14:07:46 raspberrypi homebridge[340]: [1/5/2019, 2:07:46 PM] Loading 0 accessories…
    Jan 05 14:07:46 raspberrypi homebridge[340]: [1/5/2019, 2:07:46 PM] [Tahoma] Unable to login: Error: getaddrinfo EAI_AGAIN tahomalink.com tahomalink.com:443
    Jan 05 14:07:46 raspberrypi homebridge[340]: [1/5/2019, 2:07:46 PM] [Tahoma] Unable to login: Error: getaddrinfo EAI_A

    if I type “sudo systemctl stop homebridge” and then “sudo systemctl start homebridge”, it works, but if I reboot, I get same issue…

    1. So it works when you manually run it with sudo? Most likely a rights issue. Try removing the homebridge user from the services file

      1. Hi Tim

        yes it works when I run manually but it look like homebridge does not start on boot.
        I’ve tried removing homebridge user from the services file but I get same issue.
        I’ve also tried different method for run on boot like PM2 but I get same issue, homebridge does not start on boot but it works manually…

  128. And i need it to work on boot.
    Also, I tried to connect to my tahoma account but i got
    « Try later, too many request » .
    It looks like start on boot stuck the connection to the tahoma account.
    Any idea ?

      1. Hi!

        I got an erros messege:

        pi@raspberrypi:~ $ sudo cp ~/.homebridge/config.json /var/homebridge/
        cp: cannot stat ‘/home/pi/.homebridge/config.json’: No such file or directory

        1. I copied it with File manager, but finally not work.
          The service stus is working, but in my phone not.

  129. Just wanted to say Thank you! I got so close but was just missing a few things, the exact few things you had issues with. All setup and running now!

  130. Amazing guide, thank you!

    Just a simple question. If I install new plugins and accessories, should I update the files in /var/homebridge ?

  131. Hi again Tim. Unfortunately my homebridge was broken after I did everything you mention.

    Could you please help?

    I get this when I manually try to run homebridge

    events.js:183
    throw er; // Unhandled ‘error’ event
    ^

    Error: listen EADDRINUSE :::51826
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at Server.setupListenHandle [as _listen2] (net.js:1367:14)
    at listenInCluster (net.js:1408:12)
    at Server.listen (net.js:1492:7)
    at EventedHTTPServer.listen (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/util/eventedhttp.js:60:19)
    at HAPServer.listen (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:158:20)
    at Bridge.Accessory.publish (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:607:16)
    at Server._publish (/usr/lib/node_modules/homebridge/lib/server.js:128:16)
    at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:97:10)

      1. and now i get this

        [TplinkSmarthome] didFinishLaunching
        [1/16/2019, 8:47:15 PM] [TplinkSmarthome.API] client.startDiscovery({“discoveryInterval”:10000,”deviceTypes”:[],”deviceOptions”:{“timeout”:15000},”macAddresses”:[],”excludeMacAddresses”:[]})
        events.js:167
        throw er; // Unhandled ‘error’ event
        ^

        Error: listen EADDRINUSE: address already in use :::51826
        at Server.setupListenHandle [as _listen2] (net.js:1290:14)
        at listenInCluster (net.js:1338:12)
        at Server.listen (net.js:1425:7)
        at EventedHTTPServer.listen (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/util/eventedhttp.js:60:19)
        at HAPServer.listen (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:158:20)
        at Bridge.Accessory.publish (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:607:16)
        at Server._publish (/usr/local/lib/node_modules/homebridge/lib/server.js:128:16)
        at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:97:10)
        at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:45:10)
        at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
        Emitted ‘error’ event at:
        at emitErrorNT (net.js:1317:8)
        at process._tickCallback (internal/process/next_tick.js:63:19)
        at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
        at startup (internal/bootstrap/node.js:283:19)
        at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

  132. Thanks for the guide. Worked through with no errors, but when I run “systemctl status homebridge” I get th following error(s):

    pi@raspberrypi:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor prese
    Active: activating (auto-restart) (Result: exit-code) since Tue 2019-01-15 12
    Process: 2066 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, sta
    Main PID: 2066 (code=exited, status=1/FAILURE)

    Jan 15 12:25:52 raspberrypi systemd[1]: homebridge.service: Main process exited,
    Jan 15 12:25:52 raspberrypi systemd[1]: homebridge.service: Unit entered failed
    Jan 15 12:25:52 raspberrypi systemd[1]: homebridge.service: Failed with result ‘
    lines 1-9/9 (END)…skipping…
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Tue 2019-01-15 12:25:52 PST; 1s ago
    Process: 2066 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 2066 (code=exited, status=1/FAILURE)

    Jan 15 12:25:52 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
    Jan 15 12:25:52 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    Jan 15 12:25:52 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.

      1. Tim, you legend….looks like i am also getting a similar error as 3920MOUSPAD3920 above….can you elaborate on your instruction to “removing the User=homebridge…..” Do i simply find the file and delete? Thank you in advance from a Raspberry Pi Noob

        Error message following “systemctl status homebridge”

        “● homebridge.service – Node.js HomeKit Server
        Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor prese
        Active: activating (auto-restart) (Result: exit-code) since Fri 2019-01-18 13
        Process: 1491 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exite
        Main PID: 1491 (code=exited, status=203/EXEC)
        lines 1-5/5 (END)”

  133. Hi Tim, Legend!

    Ive tried removing User=homebridge…..but I am now getting

    “homebridge.service
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor prese
    Active: activating (auto-restart) (Result: exit-code) since Fri 2019-01-18 14
    Process: 907 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited
    Main PID: 907 (code=exited, status=203/EXEC)

    Any clue…im a total Noob…sorry

  134. Hi Tim! Thank you so much for your work, very appreciated.

    I am trying to add an accessory to HomeKit mekit and I am getting the following error when running homebridge since it is already running automatically. How can I add an accessory while homebridge is automatically running?
    Error: listen EADDRINUSE :::52826
    at Object.exports._errnoException (util.js:1024:11)
    at exports._exceptionWithHostPort (util.js:1047:20)
    at Server.setupListenHandle [as _listen2] (net.js:1319:14)
    at listenInCluster (net.js:1367:12)
    at Server.listen (net.js:1467:7)
    at EventedHTTPServer.listen (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/util/eventedhttp.js:60:19)
    at HAPServer.listen (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:158:20)
    at Bridge.Accessory.publish (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:607:16)

  135. Hi, thank you very much for the guide, very useful! My homebridge is already running automatically with four accessories by using your guide and I have added a platform to the config.json file. but the new platform does not show up in homekit. I’ve tried rebooting the pi but that doesn’t work. When I type homebridge in terminal I see the new platform, but I still get this error. Any ideas? thank you homebridge

    [2019-1-20 12:21:33] Loaded config.json with 4 accessories and 1 platforms.
    [2019-1-20 12:21:33] —
    [2019-1-20 12:21:33] Loaded plugin: homebridge-magichome
    homebridge API version: 2.2
    [2019-1-20 12:21:33] Registering accessory ‘homebridge-magichome.MagicHome’
    [2019-1-20 12:21:33] —
    [2019-1-20 12:21:33] Loaded plugin: homebridge-tcc
    [2019-1-20 12:21:34] Registering platform ‘homebridge-tcc.tcc’
    [2019-1-20 12:21:34] —
    [2019-1-20 12:21:34] Loading 1 platforms…
    [2019-1-20 12:21:34] [Thermostat] Initializing tcc platform…
    [2019-1-20 12:21:34] [Thermostat] Logging into tcc…
    [2019-1-20 12:21:34] Loading 4 accessories…
    [2019-1-20 12:21:34] [Desk RGB’s] Initializing MagicHome accessory…
    [2019-1-20 12:21:34] [Desk RGB’s1] Initializing MagicHome accessory…
    [2019-1-20 12:21:34] [Desk Lamp] Initializing MagicHome accessory…
    [2019-1-20 12:21:34] [Ceiling RGB’s] Initializing MagicHome accessory…
    [2019-1-20 12:21:35] [Desk RGB’s] DEVICE COLOR: 255,100,50
    [2019-1-20 12:21:35] [Ceiling RGB’s] DEVICE COLOR: 255,100,50
    [2019-1-20 12:21:35] [Desk RGB’s1] DEVICE COLOR: 255,100,50
    [2019-1-20 12:21:37] [Thermostat] Logged into tcc! [ { deviceID: ‘2872685’,
    name: ‘Other Floor’,
    usePermanentHolds: false } ]
    [2019-1-20 12:21:37] [Thermostat] Adding TCC Device Other Floor 2872685
    [2019-1-20 12:21:37] [Thermostat] Initializing platform accessory ‘Other Floor’…
    [2019-1-20 12:21:37] [Thermostat] getServices Other Floor
    Setup Payload:
    X-HM://0023JGI4Y6MI9
    Scan this code with your HomeKit app on your iOS device to pair with Homebridge:

    Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐
    │ 042-43-154 │
    └────────────┘

    [2019-1-20 12:21:37] [Thermostat] updateValues 1
    events.js:182
    throw er; // Unhandled ‘error’ event
    ^

    Error: listen EADDRINUSE :::52826
    at Object.exports._errnoException (util.js:1024:11)
    at exports._exceptionWithHostPort (util.js:1047:20)
    at Server.setupListenHandle [as _listen2] (net.js:1319:14)
    at listenInCluster (net.js:1367:12)
    at Server.listen (net.js:1467:7)
    at EventedHTTPServer.listen (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/util/eventedhttp.js:60:19)
    at HAPServer.listen (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:158:20)
    at Bridge.Accessory.publish (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:607:16)
    at Server._publish (/usr/local/lib/node_modules/homebridge/lib/server.js:128:16)
    at Server. (/usr/local/lib/node_modules/homebridge/lib/server.js:404:14)
    pi@raspberrypi:~ $

    1. That error sounds like it is already running. Since it automatically starts you may have to reboot or stop the service. Also make sure you are adding the new platform to the correct config.json located in /var/homebridge/

  136. This has solved a lot of my issues, thank you. I am having a problem adding new plugins to my homebridge now. Whenever I try to enter a command like npm install -g homebridge-nest, I am getting a lot of errors. At a high level, is there any differences I need to do when adding plugins to my homebridge?

  137. Hi
    Also I had to remove “local” but now it works.
    When I started it manually i use the flag “-I” to se the devices in the web browser “homebridge -I” (“I” as in I’m).
    Where exactly should I put this flag now?
    (please be specific, as in what file, and where , I am noob still).
    thx

  138. Hello,

    thanks for all your help, I followed your instruction and it is all working perfectly except one plugin. I tried to remove “User=homebrige” but that caused home bridge not to run on boot.

    my only issue is the following error
    “Jan 29 00:28:05 raspberrypi homebridge[349]: [NestCam]Failed to request access token. getaddrinfo EAI_AGAIN home.nest.com:443”

    If I run the following command
    sudo systemctl restart homebridge then everything works fine,

    please help.

    1. Great job! My first thought could be that the service is starting before your device has an ip. You could try adding a delay to the execution of starting the service.

      1. Tim,

        Sudo systemctl restart homebridge works

        but

        Sudo systemctl reload daemon gets me the same fault

        Btw if you can help me on how to create a delay, i will try that, what command should i enter in the config files

        also is there a command I can use in the config file to restart homebridge if the delay doesn’t work.

        Thanks a million!

        I searched but you are the guru, I don’t want to mess up.

          1. I tried that and it doesn’t work, its just weird, that’s the only plugin with this issue, I gave up and created a siri shortcut to restart the homebridge,

            on boot it will always fails,
            so I just sudo systemd restart homebridge and it loads fine.

            I tried and tried every method out there and gave up 🙁

            Thanks for your help Tim

  139. Hi Tim,

    I’m working on a new Pi 3B+ and keep encountering this error report:
    homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Sat 2019-02-02 12:22:38 EST; 676ms ago
    Process: 1865 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)
    Main PID: 1865 (code=exited, status=203/EXEC)

    Feb 02 12:22:38 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    Feb 02 12:22:38 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.

    I’m very new to working with any sort of code, but the error keeps apparently point to the $HOMEBRIDGE_OPTS, which is under the step where you say to remove the local direction…I’m not sure if I’m doing that correctly. I’ve been pasting that command in my remote terminal, but it won’t fix the error. Can you point me in the right direction please?

  140. Hi Tim,

    This is working great so far. The only issue I seem to have is that anytime I add a new accessory to config.json, it doesn’t show up in Home unless I copy the config file and restart homebridge. Is there any way around this so that anything added to the config.json file will automatically work and show up in the Home app?

    Thanks!

  141. Thanks for the write-up! I’m a total noob, and have a question that obviously isn’t a problem for anybody else here. After I copy the gist, what command do I use to “save” it or whatever to continue to the next step?

  142. Hello,

    at first, I would like to say thank you for the great job!

    I have a question for you. I am trying to solve problem, how can I define, which version of node.js will run with Homebridge. When I am running Homebridge via command, app will start with node js v11.12.0, every plugins is working normaly. When I am runing homebridge with Bootup, probably it start with node js 8.9.0. That is the reason, why newer plugin cant run correctly. Main problem I have with Xiaomi robot vacuum cleaner. I tried everything, how to update node js in Rasp pi. I tried to uninstall node js. Everything was not working. Is there some way, how to define correct node js version for homebridge.service?

    Thank you for the answer.

  143. Hi Tim,

    Thanks a lot for this! Sadly, thus far it won’t run when I boot it up. The first thing I’m trying to do is remove the user=Homebridge from the homebridge.service file, but it won’t let me! I am a total NOOB in case that wasn’t clear:) Root is the owner of the file, do I log in as Root and change it? How?
    Any tips?

    This is what the status says btw:
    apr 18 00:04:05 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    apr 18 00:04:05 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.
    apr 18 00:04:13 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.

    I appreciate it!

    1. Glad it’s helped. Try adding “sudo” in from of the command when you are editing the file. Let me know if that helps.

  144. Worked perfectly, thanks.

    I noticed a small typo. You wrote

    “If you are still having issues, try removing the User=hombridge from the homebridge.service file”

    That should be “User=homebridge”.

    Thanks for your instructions!

    D.

  145. Hi,
    Thanks for a great tutorial. I’m having one issue. The log is below:

    — Logs begin at Mon 2019-04-29 09:08:22 BST. —
    Apr 29 10:58:03 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
    Apr 29 10:58:03 raspberrypi systemd[1]: Started Node.js HomeKit Server.
    Apr 29 10:58:03 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
    Apr 29 10:58:03 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    Apr 29 10:58:03 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.
    Apr 29 10:58:10 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
    Apr 29 10:59:40 raspberrypi systemd[1]: Started Node.js HomeKit Server.
    Apr 29 10:59:40 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=203/EXEC
    Apr 29 10:59:40 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    Apr 29 10:59:40 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.

    Any ideas please?

        1. I spoke too soon!
          When Homebridge starts up I don’t get the QR code onscreen just the number for Homekit.
          I enter that manually but all it sees is the bridge and no accessories.
          If I just start homebridge manually everything works ok.

  146. Hi Tim, I’ve installed a new plugin but am getting this error using journctl:

    May 10 01:43:10 oldpi homebridge[2172]: [2019-5-10 01:43:10] Error: Plugin /usr/local/lib/node_modules/homebridge-panasonic-viera-tv requires a HomeBridge version of ^0.4.46 which does not satisfy the current HomeBridge version of 0.4.42. You may need to upgrade your installation of HomeBridge.

    I’ve run:

    sudo npm install -g –unsafe-perm homebridge

    and whilst it seems something has updated I still get the same error..

    is there a special trick to updating homebridge whilst it’s running as a service?

    Many thanks
    (especially for this guide and all the advice you’re giving!)

      1. Yes, when running it manually from ~/.homebridge it seems to work.. (I’ve been using sudo systemctl disable homebridge to stop the service from running in the background)

  147. Got some errors with this one, but then figured I run Homebridge as root (ps -ef | grep homebridge), so changed User to root in
    sudo nano /etc/systemd/system/homebridge.service and now it seems to work just fine

  148. Hey Tim, I had updated npm/node (can’t remember which) for my setup before attempting your writeup. I noticed now, for my roborock (vacuum) plugin, it warns me that the version of npm or node is not past 10.x.x, I was wondering if I needed to update everything again in his new location that homebridge runs?

      1. Hmm that doesn’t explain the ‘warning’, which in my original setup I had got rid of by updating, I am also getting very slow ‘updating’ behaviour for anything attached to Homebridge now. How would I go about a global update if that is not what I had already done accidentally? Thanks son for your help.

  149. Hello,
    If homebridge starts as a service it only Initializing HarmonyHub platform and doesn’t register plugin or any harmony hub activities, but if I stop homebridge service and start or run
    `sudo systemctl restart homebridge`
    all works fine.
    Any ideas how to fix homebridge service startup?

    Thank you so much
    ### Versions

    – **Homebridge**: `homebridge –version` 0.4.50
    – **Node**: `node –version` v12.4.0
    – **OS**:
    Distributor ID: Raspbian
    Description: Raspbian GNU/Linux 9.9 (stretch)
    Release: 9.9
    Codename: stretch

    ### Configuration

    “`json
    {
    “bridge”: {
    “name”: “Homebridge”,
    “username”: “CC:22:3D:E3:CE:30”,
    “port”: 51826,
    “pin”: “031-45-154”
    },
    “platforms”: [
    {
    “name”: “Config”,
    “port”: 8080,
    “auth”: “form”,
    “theme”: “teal”,
    “tempUnits”: “f”,
    “sudo”: true,
    “platform”: “config”
    },
    {
    “platform”: “HarmonyHub”,
    “name”: “homebridge-harmonyhub-plugin”
    }
    ]
    }

    “`
    “`service
    [Unit]
    Description=Node.js HomeKit Server
    After=syslog.target network-online.target

    [Service]
    Type=simple
    User=homebridge
    EnvironmentFile=/etc/default/homebridge
    ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS
    Restart=on-failure
    RestartSec=10
    KillMode=process

    [Install]
    WantedBy=multi-user.target
    “`

    ### Homebridge Log / Command Output
    After rebooting system (fresh start)
    “`
    pi@raspberrypi:~$ journalctl -u homebridge
    — Logs begin at Sun 2019-06-09 13:06:04 CDT, end at Sun 2019-06-09 13:06:58 CDT. —
    Jun 09 13:06:06 raspberrypi systemd[1]: Started Node.js HomeKit Server.
    Jun 09 13:06:10 raspberrypi homebridge[350]: [6/9/2019, 13:06:10] Loaded config.json with 0 accessories and 2 platforms.
    Jun 09 13:06:10 raspberrypi homebridge[350]: [6/9/2019, 13:06:10] —
    Jun 09 13:06:10 raspberrypi homebridge[350]: [6/9/2019, 13:06:10] Loaded plugin: homebridge-config-ui-x
    Jun 09 13:06:10 raspberrypi homebridge[350]: [6/9/2019, 13:06:10] Registering platform ‘homebridge-config-ui-x.config’
    Jun 09 13:06:10 raspberrypi homebridge[350]: [6/9/2019, 13:06:10] —
    Jun 09 13:06:11 raspberrypi homebridge[350]: [6/9/2019, 13:06:11] Loaded plugin: homebridge-harmonyhub-plugin
    Jun 09 13:06:11 raspberrypi homebridge[350]: [6/9/2019, 13:06:11] Registering platform ‘homebridge-harmonyhub-plugin.HarmonyHub’
    Jun 09 13:06:11 raspberrypi homebridge[350]: [6/9/2019, 13:06:11] —
    Jun 09 13:06:11 raspberrypi homebridge[350]: [6/9/2019, 13:06:11] Loading 2 platforms…
    Jun 09 13:06:11 raspberrypi homebridge[350]: [6/9/2019, 13:06:11] [Config] Initializing config platform…
    Jun 09 13:06:11 raspberrypi homebridge[350]: [6/9/2019, 13:06:11] [Config] Spawning homebridge-config-ui-x with PID 468
    Jun 09 13:06:11 raspberrypi homebridge[350]: [6/9/2019, 13:06:11] [homebridge-harmonyhub-plugin] Initializing HarmonyHub platform…
    Jun 09 13:06:11 raspberrypi homebridge[350]: Setup Payload:
    Jun 09 13:06:11 raspberrypi homebridge[350]: X-HM://0023ISYWYB2M8
    Jun 09 13:06:11 raspberrypi homebridge[350]: Scan this code with your HomeKit app on your iOS device to pair with Homebridge:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]: Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]: ┌────────────┐
    Jun 09 13:06:11 raspberrypi homebridge[350]: │ 031-45-154 │
    Jun 09 13:06:11 raspberrypi homebridge[350]: └────────────┘
    Jun 09 13:06:11 raspberrypi homebridge[350]:
    Jun 09 13:06:11 raspberrypi homebridge[350]: [6/9/2019, 13:06:11] Homebridge is running on port 51826.
    Jun 09 13:06:16 raspberrypi homebridge[350]: [6/9/2019, 13:06:16] [Config] Console v4.4.5 is listening on :: port 8080
    “`
    ### Homebridge Log / Command Output
    After `sudo systemctl restart homebridge`
    “`
    Jun 09 13:09:42 raspberrypi homebridge[645]: [6/9/2019, 13:09:42] Loaded config.json with 0 accessories and 2 platforms.
    Jun 09 13:09:42 raspberrypi homebridge[645]: [6/9/2019, 13:09:42] —
    Jun 09 13:09:42 raspberrypi homebridge[645]: [6/9/2019, 13:09:42] Loaded plugin: homebridge-config-ui-x
    Jun 09 13:09:42 raspberrypi homebridge[645]: [6/9/2019, 13:09:42] Registering platform ‘homebridge-config-ui-x.config’
    Jun 09 13:09:42 raspberrypi homebridge[645]: [6/9/2019, 13:09:42] —
    Jun 09 13:09:43 raspberrypi homebridge[645]: [6/9/2019, 13:09:43] Loaded plugin: homebridge-harmonyhub-plugin
    Jun 09 13:09:43 raspberrypi homebridge[645]: [6/9/2019, 13:09:43] Registering platform ‘homebridge-harmonyhub-plugin.HarmonyHub’
    Jun 09 13:09:43 raspberrypi homebridge[645]: [6/9/2019, 13:09:43] —
    Jun 09 13:09:43 raspberrypi homebridge[645]: [6/9/2019, 13:09:43] Loading 2 platforms…
    Jun 09 13:09:43 raspberrypi homebridge[645]: [6/9/2019, 13:09:43] [Config] Initializing config platform…
    Jun 09 13:09:43 raspberrypi homebridge[645]: [6/9/2019, 13:09:43] [Config] Spawning homebridge-config-ui-x with PID 668
    Jun 09 13:09:43 raspberrypi homebridge[645]: [6/9/2019, 13:09:43] [homebridge-harmonyhub-plugin] Initializing HarmonyHub platform…
    Jun 09 13:09:43 raspberrypi homebridge[645]: Setup Payload:
    Jun 09 13:09:43 raspberrypi homebridge[645]: X-HM://0023ISYWYB2M8
    Jun 09 13:09:43 raspberrypi homebridge[645]: Scan this code with your HomeKit app on your iOS device to pair with Homebridge:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]: Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]: ┌────────────┐
    Jun 09 13:09:43 raspberrypi homebridge[645]: │ 031-45-154 │
    Jun 09 13:09:43 raspberrypi homebridge[645]: └────────────┘
    Jun 09 13:09:43 raspberrypi homebridge[645]:
    Jun 09 13:09:43 raspberrypi homebridge[645]: [6/9/2019, 13:09:43] Homebridge is running on port 51826.
    Jun 09 13:09:45 raspberrypi homebridge[645]: [6/9/2019, 13:09:45] [homebridge-harmonyhub-plugin] {HarmonyHub} Found hubs
    Jun 09 13:09:45 raspberrypi homebridge[645]: [6/9/2019, 13:09:45] [homebridge-harmonyhub-plugin] {HarmonyHub}
    Jun 09 13:09:46 raspberrypi homebridge[645]: [6/9/2019, 13:09:46] [homebridge-harmonyhub-plugin] {HarmonyHub} create new client for
    Jun 09 13:09:46 raspberrypi homebridge[645]: [6/9/2019, 13:09:46] [homebridge-harmonyhub-plugin] {HarmonyHub} Found activities: <Work on Computer, Listen to Music, Volume Up, Volume Down, Wat
    Jun 09 13:09:47 raspberrypi homebridge[645]: [6/9/2019, 13:09:47] [Config] Console v4.4.5 is listening on :: port 8080
    “`

  150. Hi Tim, here is my situation. I am relatively new to homebridge, as well as Raspbery Pi. I can run everything just fine, from the command line. However when I attempt to run as a service, it fails…I’m stumped.

    ### versions
    $ cat /proc/device-tree/model
    Raspberry Pi 3 Model B Rev 1.2
    $ uname -a
    Linux raspberrypi 4.19.42-v7+ #1219 SMP Tue May 14 21:20:58 BST 2019 armv7l GNU/Linux
    $ node –version
    v10.16.0
    $ npm –version
    6.9.0
    $ homebridge –version
    0.4.50

    1. I triple checked to ensure that all configuration command were proceeded with sudo
    2. Within homebridge.service, I attempted to run with (step 2)
    ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS
    , as well as
    ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS
    3. I also tried removing try removing the User=homebridge from the homebridge.service file

    Did not work at all with ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS, received the following error:
    ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=203/EXEC)

    After changing to ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS, slightly better, but got the following:
    Jun 10 19:57:47 raspberrypi systemd[1]: Started Node.js HomeKit Server.
    Jun 10 19:57:49 raspberrypi homebridge[9515]: [6/10/2019, 7:57:49 PM] Loaded config.json with 2 accessories and 4 platforms.
    Jun 10 19:57:49 raspberrypi homebridge[9515]: [6/10/2019, 7:57:49 PM] —
    Jun 10 19:57:49 raspberrypi homebridge[9515]: [6/10/2019, 7:57:49 PM] No plugins found. See the README for information on installing plugins.
    Jun 10 19:57:49 raspberrypi homebridge[9515]: [6/10/2019, 7:57:49 PM] Loading 4 platforms…
    Jun 10 19:57:49 raspberrypi homebridge[9515]: [6/10/2019, 7:57:49 PM] Error: The requested platform ‘LC7001’ was not registered by any plugin.
    Jun 10 19:57:49 raspberrypi homebridge[9515]: at API.platform (/usr/lib/node_modules/homebridge/lib/api.js:134:13)
    Jun 10 19:57:49 raspberrypi homebridge[9515]: at Server._loadPlatforms (/usr/lib/node_modules/homebridge/lib/server.js:327:45)
    Jun 10 19:57:49 raspberrypi homebridge[9515]: at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:90:36)
    Jun 10 19:57:49 raspberrypi homebridge[9515]: at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:59:10)
    Jun 10 19:57:49 raspberrypi homebridge[9515]: at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
    Jun 10 19:57:49 raspberrypi homebridge[9515]: at Module._compile (internal/modules/cjs/loader.js:776:30)
    Jun 10 19:57:49 raspberrypi homebridge[9515]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    Jun 10 19:57:49 raspberrypi homebridge[9515]: at Module.load (internal/modules/cjs/loader.js:653:32)
    Jun 10 19:57:49 raspberrypi homebridge[9515]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    Jun 10 19:57:49 raspberrypi homebridge[9515]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    Jun 10 19:57:49 raspberrypi homebridge[9515]: [6/10/2019, 7:57:49 PM] Got SIGTERM, shutting down Homebridge…
    Jun 10 19:57:54 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=143/n/a
    Jun 10 19:57:54 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    Jun 10 19:57:54 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.

    pi@raspberrypi:/var/homebridge $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Mon 2019-06-10 21:29:43 CDT; 35ms ago
    Process: 10121 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=143)
    Main PID: 10121 (code=exited, status=143)

    journalctl -f -u homebridge

    Jun 10 21:32:11 raspberrypi systemd[1]: Started Node.js HomeKit Server.
    Jun 10 21:32:13 raspberrypi homebridge[10347]: [6/10/2019, 9:32:13 PM] Loaded config.json with 2 accessories and 4 platforms.
    Jun 10 21:32:13 raspberrypi homebridge[10347]: [6/10/2019, 9:32:13 PM] —
    Jun 10 21:32:13 raspberrypi homebridge[10347]: [6/10/2019, 9:32:13 PM] No plugins found. See the README for information on installing plugins.
    Jun 10 21:32:13 raspberrypi homebridge[10347]: [6/10/2019, 9:32:13 PM] Loading 4 platforms…
    Jun 10 21:32:13 raspberrypi homebridge[10347]: [6/10/2019, 9:32:13 PM] Error: The requested platform ‘LC7001’ was not registered by any plugin.
    Jun 10 21:32:13 raspberrypi homebridge[10347]: at API.platform (/usr/lib/node_modules/homebridge/lib/api.js:134:13)
    Jun 10 21:32:13 raspberrypi homebridge[10347]: at Server._loadPlatforms (/usr/lib/node_modules/homebridge/lib/server.js:327:45)
    Jun 10 21:32:13 raspberrypi homebridge[10347]: at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:90:36)
    Jun 10 21:32:13 raspberrypi homebridge[10347]: at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:59:10)
    Jun 10 21:32:13 raspberrypi homebridge[10347]: at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
    Jun 10 21:32:13 raspberrypi homebridge[10347]: at Module._compile (internal/modules/cjs/loader.js:776:30)
    Jun 10 21:32:13 raspberrypi homebridge[10347]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    Jun 10 21:32:13 raspberrypi homebridge[10347]: at Module.load (internal/modules/cjs/loader.js:653:32)
    Jun 10 21:32:13 raspberrypi homebridge[10347]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    Jun 10 21:32:13 raspberrypi homebridge[10347]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    Jun 10 21:32:13 raspberrypi homebridge[10347]: [6/10/2019, 9:32:13 PM] Got SIGTERM, shutting down Homebridge…
    Jun 10 21:32:18 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=143/n/a
    Jun 10 21:32:18 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
    Jun 10 21:32:18 raspberrypi systemd[1]: homebridge.service: Failed with result ‘exit-code’.
    Jun 10 21:32:28 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
    Jun 10 21:32:28 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.

  151. Hi Tim, Ik have been using Hombridge for years and am really loving it.

    There is one thing I never found a solution for. My Domoticz needs to be up and running before Homebridg can get it’s info. If I start both on boot Homebridge will try too fast to get the info it needs and it will not get any accessories. I have tried fiddling with the After= section in the .service file to no avail.

    Got any ideas?

  152. Hi Tim

    Thanks for the great work, i just have one issue

    everything inputted correctly with no errors but when turning devices on via iphone homekit nothing happens. Devices shows on app and lights up as it was on but actual device isnt turning on.

    any tips?

    1. Thanks! Most likely it is a permission error. Since its starting Homebridge with a different user, some things may not work without the correct permissions.

  153. Did everything , the same steps used , but doesn’t work , got this error instead :

    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: inactive (dead) (Result: exit-code) since Fri 2019-08-02 23:22:48 +08; 2s ago
    Process: 1416 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 1416 (code=exited, status=1/FAILURE)

    More info: I’m also running MagicMirror on the same Raspberry Pi, just confirming, if I were to successfully autostart Homebridge at boot, will the autostart at boot for MagicMirror not function anymore since I’m adding a new user to autostart Homebridge this way ? Thank you if u can shed some lights on my problem and question.

  154. I am receiving the following error. I tried removing the User=homebridge from the homebridge.service file. I am using a Pi 3 B+ with Raspbian GNU/Linux 10 (buster)

    homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor prese
    Active: activating (auto-restart) (Result: exit-code) since Fri 2019-08-09 23
    Process: 1447 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, sta
    Main PID: 1447 (code=exited, status=203/EXEC)

    Aug 09 23:41:01 raspberrypi systemd[1]: homebridge.service: Main process exited,
    Aug 09 23:41:01 raspberrypi systemd[1]: homebridge.service: Failed with result ‘
    lines 1-8/8 (END)

  155. Glad to see you’re still offering some support for noobies like myself.
    I had this working originally, but for some reason I was not able to access the UI via IP address until I ran “homebridge” command. I tried “sudo systemctl stop homebridge” and start, but still couldn’t access it.

    My question right now is, I went to delete the persist folder, and was denied permission. I tried to edit the folder’s permissions but was denied there as well. I searched the comments here but was not able to see how to actually change these.

    Thanks!

  156. 2019-09-03 13:27:47.987 [INFO ] [me.storage.json.internal.JsonStorage] – Json storage file at ‘/var/lib/openhab2/jsondb/backup/1560962952686–homekit.json’ is used (backup 1).

    Has anybody an idea why a backup config.json is used instead the /var/homebridge/config.json

    I previously had it running but then I had to reinstall the whole system and got stuck here. Any help very appreciated.

  157. I’m struggling to launch the service using this guidelines:

    pi@cam /etc/systemd/system $ sudo systemctl start homebridge
    Failed to start homebridge.service: Unknown unit: homebridge.service
    See system logs and ‘systemctl status homebridge.service’ for details.

    pi@cam /etc/systemd/system $ systemctl status homebridge.service
    Failed to get properties: No such interface ”

    Can someone help me out?

  158. im using Pi3B+, for me, do not remove /local in that step.
    to know if you need to remove it or not, just type “which homebridge” it tells you where yours is installed, and for me, it showed …/local/…. so i needed it !.

    after that everything works out !!

    thanks much for the write still !

    1. When I installed Stretch on my 3B+, I didn’t need /local.

      When I did a new flash of Buster on the same 3B+, /local is required.

      Can anyone else confirm this with Buster?

  159. pi@raspberrypi:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor pres
    Active: activating (auto-restart) (Result: exit-code) since Fri 2019-10-11 1
    Process: 1114 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exit
    Main PID: 1114 (code=exited, status=203/EXEC)

    Oct 11 12:27:45 raspberrypi systemd[1]: homebridge.service: Unit entered failed
    Oct 11 12:27:45 raspberrypi systemd[1]: homebridge.service: Failed with result
    lines 1-8/8 (END)…skipping…
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor pres
    Active: activating (auto-restart) (Result: exit-code) since Fri 2019-10-11 1
    Process: 1114 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exit
    Main PID: 1114 (code=exited, status=203/EXEC)

    Oct 11 12:27:45 raspberrypi systemd[1]: homebridge.service: Unit entered failed
    Oct 11 12:27:45 raspberrypi systemd[1]: homebridge.service: Failed with result
    ~
    ~
    ~
    ~
    ~
    how to resolve this

  160. Jul 12 18:51:19 raspberrypi systemd[1]: /etc/systemd/system/homebridge.service:25: Unknown lvalue ‘Description’ in section ‘Install’, ignoring
    Jul 12 18:51:19 raspberrypi systemd[1]: /etc/systemd/system/homebridge.service:26: Unknown lvalue ‘Wants’ in section ‘Install’, ignoring
    Jul 12 18:51:19 raspberrypi systemd[1]: /etc/systemd/system/homebridge.service:27: Unknown lvalue ‘After’ in section ‘Install’, ignoring
    Jul 12 18:51:19 raspberrypi systemd[1]: homebridge.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.
    Jul 12 18:58:02 raspberrypi systemd[1]: /etc/systemd/system/homebridge.service:13: Unknown lvalue ‘Description’ in section ‘Install’, ignoring
    Jul 12 18:58:02 raspberrypi systemd[1]: /etc/systemd/system/homebridge.service:14: Unknown lvalue ‘After’ in section ‘Install’, ignoring
    Jul 12 18:58:02 raspberrypi systemd[1]: /etc/systemd/system/homebridge.service:25: Unknown lvalue ‘Description’ in section ‘Install’, ignoring
    Jul 12 18:58:02 raspberrypi systemd[1]: /etc/systemd/system/homebridge.service:26: Unknown lvalue ‘Wants’ in section ‘Install’, ignoring
    Jul 12 18:58:02 raspberrypi systemd[1]: /etc/systemd/system/homebridge.service:27: Unknown lvalue ‘After’ in section ‘Install’, ignoring
    Jul 12 18:58:02 raspberrypi systemd[1]: homebridge.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.

    I’m wondering if this is just because I’m late to the Pi party and possibly the code is now deprecated?
    Raspberry Pi 3.
    I apologise, I’m a complete beginner, so I’m a complete noob when it comes to programming anything.

    1. Hey Danie yes it’s likely this will not work due to being outdated. Hoody you can use it as a general guide on how to setup homebridge.

Leave a Reply

Your email address will not be published. Required fields are marked *