Skip to content

Instantly share code, notes, and snippets.

@philfreo
Last active December 28, 2019 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philfreo/c7bcffdfe917e9dbb4d0d5df2ce74245 to your computer and use it in GitHub Desktop.
Save philfreo/c7bcffdfe917e9dbb4d0d5df2ce74245 to your computer and use it in GitHub Desktop.
Homebridge Docker Raspberry Pi Setup

Overview

Setup Homebridge to run via Docker on a Raspberry Pi.

Assume source of truth for files is on laptop, and you want to "deploy" them to Pi upon changes.

One-time setup

  • In this directory, rename config.tpl.json to config.json for Homebridge (bigger sample here) and change the username and pin to something unique).
  • Add any Homebridge plugins to package.json and config.json
  • Setup your Raspberry Pi with your SSH key so you can just do ssh pi@rpi.local to login.
  • On the Pi, create a directory called homebridge
  • On the Pi, install Docker and Docker Compose

Deploy to Raspberry Pi

From Mac:

./push.sh

Start running Homebridge

From Raspberry Pi (ssh pi@rpi.local)

cd homebridge
sudo docker-compose up -d

More info

This uses https://github.com/oznu/docker-homebridge

Later, to upgrade to a newer version, just run:

cd homebridge
sudo docker-compose pull
sudo docker-compose up -d
{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"
},
"description": "My Homebridge",
"accessories": [
],
"platforms": [
]
}
version: '2'
services:
homebridge:
image: oznu/homebridge:debian-raspberry-pi
restart: always
network_mode: host
volumes:
- .:/homebridge
environment:
- PGID=1000
- PUID=1000
- TZ=America/New_York
- HOMEBRIDGE_CONFIG_UI=1
- HOMEBRIDGE_CONFIG_UI_PORT=8080
{
"private": true,
"dependencies": {
"homebridge": "^0.4.32"
}
}
# Push homebridge config to Raspberry Pi
set -e
rsync \
--recursive \
--links \
--perms \
--times \
--filter="dir-merge,- .gitignore" \
--exclude="push.sh" \
--human-readable \
--progress \
--compress \
. \
pi@rpi.local:homebridge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment