Homebridge installation

[Last updated: 02/12/2019]

ePrerequisite for this tutorial : Update Raspbian

What is Homebridge ? Through Homebridge it is possible to control the objects not certify Home Kit with your Apple device.

Voila 🙂

1: Prerequisite installation
1.1: Installation of Node.JS

For a raspberry PI 2 look to the point 1.1.2, for a Raspberry PI 3 go to point 1.1.3.

1.1.1: On a Raspberry PI 1 model B rev 2, enter the following commands :

wget https://nodejs.org/dist/v4.0.0/node-v4.0.0-linux-armv6l.tar.gz

tar -xvf node-v4.0.0-linux-armv6l.tar.gz

cd node-v4.0.0-linux-armv6l

sudo cp -R * /usr/local/

1.1.2 : for a Raspberry Pi 2, enter the following commands :
Note : I did not have this Raspberry Pi so I could not test them. 🙁

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

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

cd node-v4.0.0-linux-armv7l

sudo cp -R * /usr/local/

1.1.3 : For a Raspberry Pi 3, enter the following commands :

curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -

sudo apt-get install -y nodejs

1.1.4 : Checking the installation :

To check the installed version, you can use the following command : node -v

1.2: Avahi Installation

To install Avahi, enter the following command : sudo apt-get install libavahi-compat-libdnssd-dev

During the installation, it will be announced that additional disk space will be used after installation, press y, and tap ENTER.

2: Homebridge installation

Enter the following command : sudo npm install -g --unsafe-perm homebridge 

3: Start Homebridge :

Once the installation is finished, we can start Homebridge with the command : homebridge.

Do it because this will create the directory ~/.homebrige or in /home/pi/.homebridge needed for the future.

During the first boot, you will see error messages, ignore them, this is due to the fact that currently no plugin are installed. You should have + – this :

Quit the application by tapping on ctrl+c.

At this point we know that Homebridge is well installed and works correctly.

4: Homebridge Daemon

We will now automate startup of the Homebridge at the start of the Raspberry Pi.

Go to the directory /etc/init.d with the command cd /etc/init.d, then create the file “homebridge” by typing the command :  sudo nano homebridge.

Copy the code of this file.

Type ctrl+o, then ENTER to save your changes, and ctrl+x to exit the editor.

We change the script rights : sudo chmod 755 homebridge

Create the link for the Demons manager : sudo update-rc.d homebridge defaults

That’s it 🙂

See you on the next tutorial.

Leave a Reply

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