Skip to content

Install HomeBridge

Volodymyr Huz edited this page Jan 30, 2020 · 7 revisions

Install and configure HomeBridge

You need to install nvm (Node Version Manager) and Node.js latest version before it.

Install Homebridge

npm install -g homebridge

Create the config.json file

nano ~/.homebridge/config.json

{
  "bridge": {
    "name": "Homebridge",
    "username": "CC:22:3D:E3:CE:30",
    "port": 51826,
    "pin": "031-45-154"
  },

  "description": "This is an example configuration file with one fake accessory and one fake platform. You can use this as a templ$
  "ports": {
    "start": 52100,
    "end": 52150,
    "comment": "This section is used to control the range of ports that separate accessory (like camera or television) should be b$
  },
  "accessories": [
    {
      "accessory": "WeMo",
      "name": "Coffee Maker"
    }
  ],

  "platforms": [
    {
      "platform" : "PhilipsHue",
      "name" : "Hue"
    }
  ]
}

Running Homebridge on Bootup (systemd)

sudo nano /etc/default/homebridge

# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /home/osmc/.homebridge

# If you uncomment the following line, homebridge will log more 
# You can display this via systemd's journalctl: journalctl -f -u homebridge
# DEBUG=*

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

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

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

[Install]
WantedBy=multi-user.target

sudo systemctl daemon-reload

sudo systemctl enable homebridge

systemctl start homebridge

systemctl status homebridge

Clone this wiki locally