read

This article is outdated. With DSM 6.0.2 it’s now possible to start Homebridge from the GUI, so console commands are no longer required. Simply select “Use the same network as Docker host” within the network settings and launch the image. More information are at the end of the article. Many thanks to Christian Haugen for the update.

A few days ago my Nuki arrived. Even though it’s an awesome device, the lack of HomeKit support really annoyed me. While I was reading the comments on its Kickstarter page, I saw that someone wrote a Homebridge plugin to add the missing functionality. I expected the setup on my Synology to be done in minutes but have spent many hours. Some of the provided Docker images were outdated, so I got NPM errors and some images were simply not working. Also, Synology’s DSM has some Docker restrictions. So even though you might make an image run, it might no be available in your network. Frustrated as I was, I decided to build an image on my own, provide it via the hub and write a guide to hopefully save you some hours.

Register the container

First of all, login to your Synology DSM, open Docker and install marcoraddatz/homebridge version 1.0. Do not run it via DSM afterwards!

Registry Overview.

Synology’s Docker doesn’t support the --net-host command from the GUI, so the image has to be created via console—otherwise it won’t be available on your network. Create a dir at /volume1/docker/homebridge and put your config.json, package.json(optional) and install.sh (optional) in there.

Install plugins

You have at least two options to install and configure your plugins. Either put all dependencies into the package.json, or run commands from the install.sh. I only use the install.sh Here are some examples:

package.json

{
  "name": "DiskStationHomeBridge",
  "description": "HomeKit support for the impatient.",
  "version": "0.1.1",
  "license": "ISC",
  "dependencies": {
    "homebridge-harmonyhub": "0.2.0-alpha",
    "homebridge-netatmo": "^0.0.4",
    "homebridge-nukiio": "^0.0.3",
    "homebridge-synology": "^0.1.0"
  }
}

install.sh

#!/bin/sh

npm install -g homebridge-harmonyhub
npm install -g homebridge-netatmo
npm install -g homebridge-nukiio
npm install -g homebridge-synology

Once your requirements are set, open the console, login via your root user and run the container:

docker run -d --name HomeBridge --restart=always --net=host -p 51826:51826 -v /volume1/docker/homebridge:/root/.homebridge marcoraddatz/homebridge:latest

The recently created image will now appear in your DSM container overview and / or via docker ps -a. Make sure to open port 51826.

Image Overview.

Triggered tasks

Until now, the Docker image has to be started manually after each restart. Because I’m lazy, I decided to create triggered tasks to start and stop the images on boot / shutdown.

start.sh

My start.sh script is located next to the other scripts under /volume1/docker/homebridge/. To setup the script, open settings and create a triggered task within the task scheduler. Make it run on boot-up and execute /volume1/docker/homebridge/start.sh. The file contains the command from above:

#!/bin/sh

docker run -d --entrypoint /bin/bash --name HomeBridge --net=host -p 51826:51826 -v /volume1/docker/homebridge:/root/.homebridge marcoraddatz/homebridge:latest

stop.sh

Same goes for the shutdown.

#!/bin/sh

docker rm -f HomeBridge

Test your setup

You now should be able to setup your HomeKit environment. I’d recommend Eve app to play around until iOS 10 will be released.

Plugins

Homebridge is useless without any plugins. So here’s a quick overview over the plugins I currently use:

Harmony Hub

Harmony Hub integrates all my Harmony actions and devices into HomeKit. With this, I can even control devices, that aren’t supported by Homebridge yet. Also, it allows me to create advanced scenes (start my TV, Playstation, receiver and Hue lights at once) to be used with Siri.

Netatmo

The Netatmo integration allows me to ask Siri for weather station data.

Nuki

Thanks to the Nuki plugin, I can open my front door with Siri and also combine this action with other devices (f.e. close front door and turn off all lights at once when I leave).

Philips Hue

Even though most Philips Hue products already integrate perfectly into the HomeKit world, I use this plugin to control my Osram Lightify products with Siri. Within the official Hue app, it’s no longer possible to sync unofficial products with Apple’s API. But if you use this plugin and set excludephilips to true (there’s a bug in the latest NPM version, so checkout the source from Github directly via npm install -g https://github.com/thkl/homebridge-philipshue), you can control all Osram products with HomeKit/Siri, while all Philips products can be managed via their official app.

Troubleshooting

Even though the Docker image should be running, there might be some cases, that cause conflicts:

Illegal name

I was really confused why my DiskStation didn’t show up on the network until I found out, that “DiskStation @ Home” seems to be an illegal name. Try to avoid spaces and special chars—in my case “DiskStation415” solved the problem.

Non unique mac address / username

Because I also installed Homebridge on my iMac, I had to use a different username on my Synology. Changing it to CC:22:3D:E3:CE:31 works perfectly.

Permanent reconnects with Home under iOS 10

When I upgraded to iOS, all my Homebridge devices were unstable and tried to reconnect every few seconds. I couldn’t find out, why this happened, but by removing and re-adding them via Home, all works fine.

Further reading


Updates

09/26/2016

The blog post has been updated with plugin information, iOS 10 troubleshooting, and best practices.

10/02/2016

Yesterday I created a new image and changed the Docker Hub URL. Instead of marcoraddatz/synology-homebridge it’s now provided on marcoraddatz/homebridge. The old sources (on which this article bases on), are still available in the 1.0 branch.

Also, I wrote a complete guide on how to install Homebridge via DSM. It’s on Github, so feel free to fork and contribute!


Many thanks to all contributors!

Marco Raddatz

Marco Raddatz

Published

Image
Marco Raddatz #TechnicalProjectManagement #SoftwareDevelopment #Berlin Back to Overview