1. Getting Linux installed on your Raspberry Pi

Download Raspbian: https://www.raspberrypi.org/downloads/raspbian/

Write image to SD card (instructions: https://www.raspberrypi.org/documentation/installation/installing-images/README.md)

Put the SD card in the Raspberry Pi and let it boot up

Figure out what IP adress the Raspberry Pi has been assigned, either through your router or by running arp -a to show all devices on your network.

Connect to the RPi via SSH:
Default username: pi
Default password: raspberry

ssh pi@<ip address>

“The authenticity of host ‘ (’ can’t be established.” – type yes and press enter. This is just a warning to make sure you’re not connecting to an unknown server.

Congratulations, you are now logged in to your RPi.

Now expand the file system to fill the entire SD card (and make space for our Homebridge installation). Run raspi-config and select the option to expand the file system.


Then reboot the system and reconnect once it’s back online:

sudo reboot
- wait for half a minute or so -
ssh pi@<ip address>

2 Installing NodeJS

First, find the latest (or preferred) version of NodeJS on their website (or in https://nodejs.org/dist/ ). If you have a Raspberry Pi 1 you will need the file with armv6l in it’s name, and the Pi 2 will need the armv7l one.

At the time of writing this, the LTS version is 4.2.6 – the version I’ll be using for this guide.

Once you have the url to the correct file, run the following command to download it to you Pi:

wget https://nodejs.org/dist/v4.2.6/node-v4.2.6-linux-armv7l.tar.gz

Unpack the file with the following command:

tar -xvf node-v4.2.6-linux-armv7l.tar.gz

Enter the node-v4.2.6-linux-armv7l directory and copy it’s contents to

cd node-v4.2.6-linux-armv7l
/usr/local: sudo cp -R * /usr/local/

That’s it, NodeJS is now installed on your Raspberry Pi. You can verifiy this by running node -v, which should return v4.2.6 (or whatever version you downloaded):

node -v

3. Installing Homebridge

Before installing Homebridge, you need to make sure you have libavahi-compat-libdnssd-dev installed:

sudo apt-get install libavahi-compat-libdnssd-dev.

Also, we will need Git:

sudo apt-get install git

We can now install homebridge:

npm install -g homebridge

You should now be able to run homebridge, which will fail with a few errors.


4. Configuring Homebridge

First of all, we will need a configuration file. Create one using the following command:

nano ~/.homebridge/config.json

Paste this example content into the file, and change values accordingly:

  "bridge": {
    "name": "My Homebridge Name",
    "username": "CC:22:3D:E3:CE:30",
    "port": 51826,
    "pin": "123-45-678"
  "description": "My Homebridge description here",
  "accessories": [
  "platforms": [

Save the file and try starting Homebridge by running the command homebridge. It should start and your PIN-code should be visible. You should also be able to find your homebridge in the HomeKit app of choice (iDevices and Eve are fairly good, free apps).

5. Adding plugins

Now we’re ready to start adding plugins to get some actual functionality. Plugins are installed through npm:

npm install -g homebridge-http

When the installation has finished, edit the accessories-portion of your config.json to look like this (obviously with your own addresses):

"accessories": [
    "accessory": "Http",
    "name": "Doomsday device",
    "switchHandling": "yes",
    "http_method": "GET",
    "on_url": "http://whisper.address/command_on",
    "off_url": "http://whisper.address/command_off",
    "status_url": "http://whisper.address/status",
    "service": "Light",
    "brightnessHandling": "yes",
    "brightness_url": "http://http://whisper.address/brightness",
    "brightnesslvl_url": "http://whisper.address/brightlvl",
    "sendimmediately": "",
    "username" : "",
    "password" : ""

Save the file and run Homebridge again. You should now see it initialize your newly added accessory. Start your Homekit-app and try to add a new product – it should show up.

6. Starting Homebridge automatically at system start

First we need to create an init script, and for the sake of getting things done – copy this script to your clipboard: https://raw.githubusercontent.com/fhd/init-script-template/master/template

Create and edit a new init script, and paste the contents on your clipboard in it:

sudo nano /etc/init.d/homebridge

Change the first lines of the files to this:

# Provides: homebridge
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.

cmd="DEBUG=* /usr/local/bin/homebridge"

Now change the permissions for the file and “install” it:

sudo chmod 755 /etc/init.d/homebridge
sudo update-rc.d homebridge defaults

Homebridge will now launch on reboot, and you can manually start it with this command:

sudo /etc/init.d/homebridge start

Run this command to verify that homebridge starts as expected, and to see any errors. The command will show the last 30 entries from the system log:

tail -n 30 /var/log/syslog

That’s it!

At the time of writing this guide there are issues with Hombridge failing within minutes or hours from startup, a restart of homebridge seems to solve this until a fix is issued:

sudo /etc/init.d/homebridge restart



Peter Tasker · 2016-02-29 at 11:28 pm

I am following your instructions. However the command wget https://nodejs.org/dist/v5.7.0/node-v5.7.0-linux-armv7l.tar.gz does not work. (5.7.0 being the latest) connects to the nodejs.org website, sends the HTTP request, awaits response and the fails ….404 not found

Can you help please.



    rohlzon · 2016-03-01 at 7:10 am

    Hm, that’s strange, works fine when I try it. Could there be some DNS lookup problem on your Linux machine?

      Peter Tasker · 2016-03-01 at 9:03 am

      Sorry, should have said, I am using a raspberry pi 2 running raspbian.


        Peter Tasker · 2016-03-01 at 9:48 am

        Also I cap ping nodejs.org with no problems

Leave a Reply

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