Homebridge on Raspberry Pi using Docker

Homebridge is a lightweight NodeJS server you can run on your home network that emulates the iOS HomeKit API. It supports Plugins that provide a basic bridge from HomeKit to various 3rd-party “smart home” devices. This guide will cover the installation of Homebridge on raspberry pi using Docker. 

Requirements
  • A Raspberry Pi
  • Docker installed(Guide)
  • Homekit viewing capable device: iPhone/iPad/Mac
Install Homebridge

Connect to your raspberry pi running docker over SSH

ssh pi@(PI)

Assuming you have docker and docker-compose correctly setup on your raspberry pi (guide here), in your home directory. create a new folder called “homebridge” and change your directory to it

mkdir /home/pi/homebridge
cd /home/pi/homebridge

Then use nano(text editor) to create a new file

nano docker-compose.yml

A new text editor will open, paste following lines in here:

version: '2'
services:
  homebridge:
    image: oznu/homebridge:raspberry-pi
    restart: always
    network_mode: host
    volumes:
      - ./config:/homebridge
    environment:
      - PGID=1000
      - PUID=1000
      - HOMEBRIDGE_CONFIG_UI=1
      - HOMEBRIDGE_CONFIG_UI_PORT=8080

Then use “CTRL+O” to save the document and “CTRL-X” to close the editor. Now simply start your docker container.

docker-compose up -d

The first start will take some time but after a while, the WebUI should become visible on http://(IP):8080. You can disconnect your ssh session as we no longer need the terminal. Homebridge is now completely set-up and will restart automatically in case of power loss. Open the URL and log in using admin/admin.

Change default password

I recommend changing the password by going to the user panel on the top right of the main page, then click edit next to the admin account and change your password from there.

Then if you want to control your lights from this website directly, you can enable “insecure mode” by clicking the docker icon in the top right corner, select settings and enable “insecure mode” from here

Basic bridge configuration

On the config tab, you can specify your Homebridge settings

  • “name”: “Homebridge”, -> Name of the bridge as shown in Homekit
  • “username”: “C1:D2:3D:23:8E:3A”, -> Mac address of bridge as shown in homekit
  • “port”: 51827, -> Operating port, leave default
  • “pin”: “078-59-618” -> Pincode for adding the bridge in Homekit, this will be a scannable QR-code later

as a safety precaution, I recommend to at least changing these values from their defaults. Then save your config and reboot your container by clicking the docker icon on the top right and select “restart container”

Now finally open the Homekit app and click the + in the top right corner, then scan the code on your Homebridge dashboard. The bridge should automatically appear in your Home. Any devices added later should now automatically appear in your dashboard. The setup is complete and you can now add any smart devices that are currently supported by Homebridge. Eventually, your list should grow quite fast now you won’t have to pay the “premium” price for Homekit compatible hardware and generally have more smart devices to choose from.

Leave a Reply

Leave a Reply

  Subscribe  
Notify of