Permalink

Installing HomeBridge as Docker Image on Synology

02/08/2016
    This article explains how to install and omeBridge, an opensource implementation of Apples HomeKit API, on a Synology Diskstation.
    This tutorial requires that you own a Synology Diskstation with an Intel CPU that can run Docker.

    Step 1: Enable SSH
    You will need access to the commandline. To do so enable SSH on the Diskstation.

    A picture named M2

    Step 2: Install Docker
    Docker is available as official package by Synology. Before Synology published a Docker package, it was necessary to bootstrap your Synology Diskstation and install Docker manually. This is no longer necessary, ignore these (old) instructions if you own a Diskstation with Intel CPU that can run Synologies official Docker package.

    A picture named M3

    Step 3: Download the HomeBridge Docker Image
    Start the Docker Package and search the registry for "homebridge".

    A picture named M4

    Select "cbrandlehner/homebridge" and klick "Download".
    In the next dialog select "0.6-SNAPSHOT".

    A picture named M5
    The download might take some time. You can view the progress in the view "Image".

    Step 4: Configuration data for your image
    The Docker application needs to access configuration data and needs a place to store information and logs.

    Start the "Control Panel" and change to "Shared Folder". Click "Create" to create a new shared folder.

    A picture named M6

    User "Admin" needs "Read/Write" access to that folder. You can set access rights for all other users to "No access".

    A picture named M7

    A picture named M8

    A picture named M9

    A picture named M10

    Now open "File Station" and navigate to the new folder "Docker". Create a new directoy "homebridge".

    A picture named M11

    Step 4: Configuration
    Homebridge will require a configuration file in "/volume1/docker/homebridge". Homebridge will look for a file config.json. You can find a sample config file on github: https://raw.githubusercontent.com/cbrandlehner/homebridge-docker/master/config-sample.json
    It is very important that your config file is correct and matches the homebridge plugins in your docker container. I strongly recommend to install Homebridge in a non dockerized environment for testing before starting with this docker environment.
    I found it useful to store the config.json file in my home directoy on the diskstation and then move the file to the homebridge directory.

    Step 5: Configure the Docker Image
    Start the Docker GUI, select the homebridge Image and click "Launch with wizard".

    A picture named M12

    Homebridge only uses port 51826. Add this port by clicking the large "+". The Homebridge plugins I used in cbrandlehner/homebridge do not use any other ports. "Automatically map ports" is not necessary.

    A picture named M13

    No change needed with Step 2.

    A picture named M14

    Click "Advanced Settings".

    A picture named M15

    Klick "Add Folder".

    A picture named M16

    Choose the folder "docker/homebridge" you created previously.

    A picture named M17

    Docker will ask you where to mount that folder within the container.

    A picture named M18

    Choose "/root/.homebridge" as Mount path and remove the "Read-Only" restriction.

    A picture named M19

    Review settings:

    A picture named M20

    Step 6: Starting the container
    Open a SSH session with your Synology Diskstation. If you are on Windows, you can use putty or MobaXterm to do so.

    "docker images" will show you a list of your images:

    A picture named M21

    Now run the command
    docker run -d --net=host -p 51826:51826 -v /volume1/docker/homebridge:/root/.homebridge cbrandlehner/homebridge:0.6-SNAPSHOT

    Step 7: Debug

    If you like to debug, you can run a bash shell within your docker image:
    docker run -i -t --entrypoint /bin/bash --net=host -p 51826:51826 -v /volume1/docker/homebridge:/root/.homebridge cbrandlehner/homebridge:0.6-SNAPSHOT

    Now you can start homebridge with "/root/run.sh"

    The AVAHI warning can be ignored:

    # /root/run.sh
    /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
    *** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi.
    *** WARNING *** Please fix your application to use the native API of Avahi!
    *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs>
    *** WARNING *** The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
    *** WARNING *** Please fix your application to use the native API of Avahi!
    *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister>
    Loaded plugin: homebridge-ninjablock-humidity
    Registering accessory 'homebridge-ninjablock-humidity.NinjaBlock-Humidity'
    ---
    Loaded plugin: homebridge-ninjablock-temperature
    Registering accessory 'homebridge-ninjablock-temperature.NinjaBlock-Temperature'
    ---
    Loaded plugin: homebridge-philipshue
    Registering platform 'homebridge-philipshue.PhilipsHue'
    ---
    Loaded config.json with 2 accessories and 1 platforms.
    ---
    Loading 1 platforms...
    [Phillips Hue] Initializing PhilipsHue platform...
    [Phillips Hue] PhilipsHue Platform Plugin Version 0.0.2
    [Phillips Hue] Fetching Philips Hue lights...
    Loading 2 accessories...
    [NinjaBlock Temp] Initializing NinjaBlock-Temperature accessory...
    [NinjaBlock Humidity Sensor] Initializing NinjaBlock-Humidity accessory...
    [Phillips Hue] Initializing platform accessory 'Hue Spot'...
    [Phillips Hue] Initializing platform accessory 'Hue Spot 1'...
    [Phillips Hue] Initializing platform accessory 'Hue Spot 2'...
    [Phillips Hue] Initializing platform accessory 'LivingColors 1'...
    [Phillips Hue] Initializing platform accessory 'LightStrips 1'...
    Scan this code with your HomeKit App on your iOS device to pair with Homebridge:

        ┌────────────┐
        │ 031-45-154 │
        └────────────┘

    Homebridge is running on port 51826.



    The script to build the docker image is a GitHub project: https://github.com/cbrandlehner/homebridge-docker
    The docker image is on Docker Hub: https://hub.docker.com/r/cbrandlehner/homebridge/

    I appreciate any feedback, please leave a STAR on GitHub oder Docker Hub. Thanks!

13106 Aufrufe .
Hinweis
Das Weblog gibt meine persönlichen Ansichten und Kommentare wieder und entspricht nicht den Positionen meiner aktuellen oder früheren Arbeitgeber oder Kunden.
Über mich
Nach Kategorie
Meine Seiten
netcraft Linux host Blog Admin OpenNTF
Monatsarchiv