HomeBridge on a Raspberry Pi

Screen-Shot-2014-09-16-at-5.29.16-PM

 

This article is about the basic installation of HomeBridge on a Raspberry Pi. How to extend this installation for your own existing setup (eg radio plug sockets, temperature / humidity sensors, infrared devices etc.) with already existing plugins follows in one Separate articles.

Before you start the further installation, you should go over

Update your package sources and packets to avoid any problems with package dependencies.

1. Update the C ++ compiler


Note : This step is only necessary for users who are still using Raspbian Wheezy. Under Jessie you should have already installed the current version of the compiler. You can check this with g ++  4.9  v . You will get gcc version in the last line 4.9.x , you can skip this step. This also applies to Wheezy installations, where you have already updated the compiler.


To install the latest version of the compiler for Raspbian, you must first change your package sources (temporarily). To do this, use the package sources, eg via sudo nano / Etc / apt / sources .list and replace ” wheezy ” with ” jessie “. Saves the changes and executes a sudo apt  get Update to make the changes to the package sources.Then you can use sudo apt  get Install gcc  4.9 G ++  4.9 install the required version of the compiler. You can (and should) undo the changes to the package sources by editing them again via sudo nano / Etc / apt / sources .listand “jessie” again by “wheezy”. A subsequent sudo apt  get Update brings your sources back to their original state.

In order to adapt the standard compilation version to the newly installed version, these two commands are enough, which you can simply call one after the other:

Give it now g ++  v , should be in the last line output

stand.

2. Installing NodeJS


Note : There is a difference between Raspberry 1 (Raspberry A, Raspberry B, Raspberry B +, Raspberry Zero) and Raspberry 2 (Raspberry Pi B2). Please be sure to install the correct version! If you do not know which version you have, you can recognize this by the technical data. If it is a model with 1GB RAM, so it is a Raspberry 2, your Raspberry has 512MB or less, so it is a Raspberry 1.

Update 03.03.2016: Meanwhile there is a new Raspberry Pi – den Raspberry Pi 3. Also on this can be installed HomeBridge. For the NodeJS version, the ARMv7 version should also run like the Raspberry Pi 2.


Switch to the installation best through “cd” once into your home directory. Then you can see on this page , which version of NodeJS is currently “stable” in the LTS version.At the time of the article production was the 4.3.0.

Download the version to your Raspberry Pi, unzip it and change to the created directory:

  • Raspberry 1:
  • Raspberry 2:

Then copy the contents of the directory to ” / usr / local “:

In order to check the successful installation, you have a node  v , where you should now receive ” v4.3.0 ” as the output (or more recent).

If this has worked so far, you can delete the downloaded file and the unpacked folder:

  • Raspberry 1:
  • Raspberry 2:

3. Install additional packages

A few more packages are still needed for Avahi. These can be easily installed via apt:

4. Installing HomeBridge

The installation of HomeBridge itself is now very simple. An easy

Should you have HomeBridge in the latest version over npm load and install. This takes some time but should be finished in a few minutes (at least at Raspberry 1).

You can then test your installation by simply starting HomeBridge via homebridge in the terminal. There are now reports that no plugins and no configuration file were found, which is normal in the basic installation. How you integrate your devices over the plugins and appropriate configuration files, I will describe in the following blog contribution.

5. Autostart of HomeBridge

The autostart of HomeBridge is of course only useful if you have the service as far as plugins and configuration on your Raspberry Pi set up. For the sake of completeness, I will also describe this step in this article.

Here is a distinction between two possibilities: once via init.d (wheezy and older) and over systemd (Jessie and newer). Since I myself on my Raspberry Pi still use Wheezy, I go here only on the method via init.d. If you want to use systemd, here is a detailed description.

5.1 Autostart via init.d

First create a new file under ” /etc/init.d/ ” via sudo nano / Etc / init .d /homebridge , which will fill it with the following content:

Then you change the user rights and install the created script:

You can now HomeBridge easily over sudo Start / etc / init .d / homebridgestart . When you start the system, HomeBridge should also be started automatically.The output of HomeBridge you now find under ” /var/log/homebridge.log ” or ” /var/log/homebridge.err “.


This completes the basic installation of HomeKit. The next article is then about the configuration and extension of the installation. In doing so, I will focus on the control of radio-controlled sockets via Raspberry-Remote and show how sensors can be integrated.

Leave a Reply

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