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=hombridge 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.


Also published on Medium.

362 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.
    [email protected]:~ $
    ————————–
    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. [email protected]:~ $ 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

  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
    [email protected]:/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’.
    [email protected]:/home/jerry#

  9. Hi,

    Tried these steps and the service keeps exiting:

    [email protected]:/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)
    [email protected]:~/.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

    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.
      [email protected]:~ $ 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
      [email protected]:~ $ 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.
      [email protected]:~ $

      REPLY

  13. 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.

  14. 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.

  15. 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.

  16. 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?

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

    [email protected]:~ $ 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”).
    [email protected]:~ $ sudo systemctl start homebridge
    [email protected]:~ $ 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
    [email protected]:~ $

    Any clue?

  18. 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.
    [email protected]:~ $ 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
    [email protected]:~ $ 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.
    [email protected]:~ $

  19. 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

  20. 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.
    [email protected]:~ $ 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
    [email protected]:~ $ 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.
    [email protected]:~ $

    Any thoughts

  21. Hi Tim,
    Ive done everything you mentioned except when i hit sudo systemctl enable home bridge i get the following error:
    [email protected]:~ $ 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?

  22. 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

  23. 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)

  24. 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)
    [email protected]:~ $

    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!

  25. 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.

  26. 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:

    [email protected]:~ $ sudo systemctl enable homebridge
    Failed to execute operation: No such file or directory

    I must therefore have failed to create the directory.

  27. 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.

  28. 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

  29. 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]1.5
    ├─┬ [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

  30. 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!

  31. 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.

  32. 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
    [email protected]:~ $ /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
    [email protected]:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: error (Reason: Invalid argument)
    Active: inactive (dead)
    [email protected]:~ $ 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
        [email protected]:~ $ 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

  33. 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

  34. 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. 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.

  35. 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”

  36. 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?

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

  38. 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.

  39. 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

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

    [email protected]:~ $ 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)
    [email protected]:~ $ 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
    [email protected]:~ $

    what should i do
    thx for your answer

  41. 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.

  42. 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..

  43. 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!

  44. 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?

  45. 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

  46. 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

  47. 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’

  48. 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’

    [email protected]:~ $ which homebridge
    /usr/local/bin/homebridge

    I get an error when I use systemctl status homebridge

    [email protected]:~ $ 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

  49. 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

  50. 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.

  51. 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!

  52. 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.

  53. 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.

  54. [email protected]:~ $ sudo useradd –system homebridge
    useradd: user ‘homebridge’ already exists
    [email protected]:~ $ sudo mkdir /var/homebridge
    mkdir: cannot create directory ‘/var/homebridge’: File exists
    [email protected]:~ $
    [email protected]:~ $ sudo cp ~/.homebridge/config.json /var/homebridge/
    [email protected]:~ $ sudo cp -r ~/.homebridge/persist /var/homebridge
    [email protected]:~ $ sudo chmod -R 0777 /var/homebridge
    [email protected]:~ $ sudo systemctl daemon-reload
    [email protected]:~ $ 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
    [email protected]:~ $ sudo systemctl start homebridge
    [email protected]:~ $ 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
    [email protected]:~ $

    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….

  55. 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/

  56. 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 ?

  57. 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!

  58. 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.

  59. 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!

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

    Richard

  61. 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!

      [email protected]:~ $ sudo systemctl daemon-reload
      [email protected]:~ $ sudo systemctl enable homebridge
      [email protected]:~ $ sudo systemctl start homebridge
      [email protected]:~ $ 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

  62. 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

  63. 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)

  64. 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..

      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
            [email protected]:~ $ 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

            [email protected]:~ $ ls
            Desktop Documents Downloads Music oldconffiles Pictures Public python_games Templates Videos
            pi[email protected]:~ $ cd /var/homebridge
            [email protected]:/var/homebridge $ ls
            accessories config.json package-lock.json persist
            [email protected]:/var/homebridge $ cd /
            [email protected]:/ $ cd /var/homebridge
            [email protected]:/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)
            [email protected]:/var/homebridge $ ^C

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

        [email protected]:~ $ 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.

  65. 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,

    [email protected]:~ $ 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

  66. can´t get it to work. need help
    [email protected]:~ $ 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’.

  67. 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:

    [email protected]:~ $ 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

  68. 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
    [email protected]:~ $ homebridge
    however cannot the life of me get it to auto start!

    hint to the problem could be
    [email protected]:~ $ which homebridge
    /home/pi/.nvm/versions/node/v4.8.7/bin/homebridge
    Doing same using su
    [email protected]:/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
    [email protected]:~ $ 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)

  69. 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

  70. 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.

  71. 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.

  72. 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!

  73. 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!

  74. 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:

    [email protected]:/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:
    [email protected]:~ $ 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.

  75. 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”.

  76. 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!

  77. 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 🙂

  78. 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!

  79. 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?

  80. 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?

  81. 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?

    [email protected]:~ $ 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?

  82. 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

  83. 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,

  84. 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 ?

  85. 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!

  86. 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?

  87. 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

  88. 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.

  89. 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.

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

    [[email protected]:~ $ 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.

  91. 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 🙁

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

    [email protected]:~ $ 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)

  93. 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.

  94. 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!

  95. 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.

  96. 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 🙂

  97. 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

  98. Thanks Tim,

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

    Cheers,

  99. 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.

  100. 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/

  101. 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? 🙁

  102. 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

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

  104. 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

  105. 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.

  106. 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 ?

  107. 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`

  108. 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

  109. 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 [email protected]:~ $ 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

  110. 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?

  111. 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)

  112. 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

  113. 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?

  114. 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.

  115. 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/)

  116. 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.

  117. Please can you help me.

    [email protected]:/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.

  118. 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’.

  119. 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 ‘

  120. 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.

    [email protected]:~ $ 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.

  121. 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
        }]
        }]
        }
        —–

Leave a Reply

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

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