Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology

Hi,

I propose to share here ours experiences about installing HomeBridge (Homekit to Vera bridge) on Docker / Synology because I’ve been trying to install it for one week now without success, and it’s very frustating …

I tried a lot of things, following these tutorials of acn and gregorito :
http://forum.micasaverde.com/index.php/topic,31716.msg237385.html#msg237385
http://forum.micasaverde.com/index.php/topic,31716.msg256791.html#msg256791

Here is my story about that :
http://forum.micasaverde.com/index.php/topic,31716.msg267601.html#msg267601

*** UPDATE ***

You’ll find hereafter how I managed to do it.

Hi

Thank you for your thread !

As I explain I followed twice this tutorial I didn’t face any issues but whenever I start the home bridge package I don’t have :
“CP server accepting connection on port: XXXXX / HAP Server is listening”

Telling me that my wave accesoire are reachable via this port.

Here a screenshot :
http://s11.postimg.org/dxl1urb9f/Capture.png

You forget to add :

" Map all ports automatically "

I think this is required as well.

[quote=“PrBreezy, post:3, topic:190921”]You forget to add :
" Map all ports automatically "
I think this is required as well.[/quote]

You’re right. I’ve corrected post #1.

[quote=“PrBreezy, post:2, topic:190921”]Hi,
Thank you for your thread ![/quote]

Hi,

As I explain I followed twice this tutorial I didn't face any issues but whenever I start the home bridge package I don't have : "CP server accepting connection on port: XXXXX / HAP Server is listening" Telling me that my wave accesoire are reachable via this port.

I’m experiencing the same problem. Let’s continue searching …

I see on your screenshot that you speak French. We can call ourselves if you like (via Skype).

Regards.

Make sure you install the latest Java 8. Also make sure you SSH into the synology using the username root. I use the following code to start it on docker:

docker run --restart="always" -d --name="Home-Automation-Bridge" --net="host" -e SERVERIP="192.168.1.107" -e SERVERPORT="51123" -e VERAIP="192.168.1.19" -e HARMONYIP="192.168.1.7" -e HARMONYUSER="user@gmail.com" -e HARMONYPWD="password" -v /volume1/public/:/config:rw -v /etc/localtime:/etc/localtime:ro aptalca/home-automation-bridge

I inserted restart always. That way whenever the synology restarts, I dont have to login through SSH to start it up again.

I think your making more difficult than it should be. Just install the following through “Package Center”: Docker, Node.js, Git, Git Server, Python, Java 8 and then SSH into the synology by using root@192.168.XXX.XXX then run the code I pasted above, but obviously make sure you change the IP addresses, ports and username and password for harmony.

Add the following package source in package center to install Java 8 http://packages.pcloadletter.co.uk/

Hi,

If I correctly understand this docker image “aptalca/home-automation-bridge” needs first to be download and then when have to install the following package on synology:

When it’ s done login by SSH to synology and run the image by the following command :
docker run --restart=“always” -d --name=“Home-Automation-Bridge” --net=“host” -e SERVERIP=“192.168.1.107” -e SERVERPORT=“51123” -e VERAIP=“192.168.1.19” -e HARMONYIP=“192.168.1.7” -e HARMONYUSER="user@gmail.com" -e HARMONYPWD=“password” -v /volume1/public/:/config:rw -v /etc/localtime:/etc/localtime:ro aptalca/home-automation-bridge

Option:
-e SERVERIP=“192.168.1.107” → Put your synology IP correct ?
-e SERVERPORT=“51123” → What is this port ?
-e VERAIP=“192.168.1.19” → IP of vera
-e HARMONYIP=“192.168.1.7” , -e HARMONYUSER="user@gmail.com" , -e HARMONYPWD=“password” → harmony settings
-v /volume1/public/:/config:rw -v /etc/localtime:/etc/localtime:ro → config folder

aptalca/home-automation-bridge → docker image

I presume this is compatibly with Siri ?

I will try in few hours.

Thank you for your respond.

I’m sorry, I just realized this thread is for HomeKit, not Amazons Alexa. The above directions are for Integration with Alexa. Which is by the way, a lot better than Siri since you don’t ever have to push a button.

But in my directions above, you would install all those packages and then run the code. And the code will automatically download the docker image, configure it and then run it.

Hi,

It seems that the Avahi daemon doesn’t properly quit when you stop the container, and you have to start 2 times avahi at the next boot (the first time, it’ll clear the PID).

/etc/init.d/dbus restart service avahi-daemon start service avahi-daemon start

Furthermore, it’s a little bit complex to dockerize the software because you’ll have to launch it with “–net=host” parameter, otherwise the avahi-daemon would not be accessible from the outside.

The container can be launched by script or by this command : docker run -d --net=host -p xxxxx:yyyyy [container’s name or path ?]

However, the problem is that I don’t know how to launch the container I created with this kind of command, and I don’t even know where Docker stores this container on the Synology …

I also tested cbrandlehner’s image, but it needs the VERA plugin and I don’t know how to add it inside … To try it, you can create a “homebridge” folder in /volume1/docker/, and put config.json there.

mkdir -p /volume1/docker/homebridge chown root:root /volume1/docker/homebridge

Then, the container can be run using this script :

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

Last but not least, I see someone has decided to install HomeBridge directly onto the Syno, not via Docker. Here is his explanation. But it seems to me that this solution is not as good as docker, because you can break it with a software update.

To be continued …

Hi,

We can give many thanks to Chris Brandlehner who posted a detailed tutorial about installing his Homekit container onto a Synology NAS.

I just asked him if he could also add the VERA plugin into his container, because I don’t manage to do it myself.

I’ll let you know.

Regards.

[quote=“tahitibub, post:11, topic:190921”]Hi,

We can give many thanks to Chris Brandlehner who posted a detailed tutorial about installing his Homekit container onto a Synology NAS.

I just asked him if he could also add the VERA plugin into his container, because I don’t manage to do it myself.

I’ll let you know.

Regards.[/quote]

I have a Synology NAS also are waiting to hear how this pans out as I want to try out HomeKit as well and would rather run it in my NAS then any other device since it is already running 24/7.

So thanks for posting this and hoping it works out soon! :+1:

Hi guys,

Im able to get the VeraHomeBridge works on a standalone linux server but not with a docker even if I use the the --net=host my container is not able to communicate over my network.

I suggest you guys to made a standalone debian server and follow all steps.

good luck !

Hi everybody,

After many attempts, I finally managed to do it!

I will explain here how to do tomorrow.

Regards

Hi,

As promised, you’ll find below instructions about how to install HomeBridge/Vera on a Synology NAS using Docker.

In order to follow this tutorial, you’ll need to activate SSH (see Control Panel → “Terminal & SNMP” menu → “Terminal” tab → “Enable SSH service” checkbox) and to install Docker (from the Synology Package Center).

1 - SSH to the SYNO and create a “homebridge” folder somewhere in /volume1/docker/

  • SSH onto the SYNO *

ssh root@<SYNO_IP> -p <PORT>

  • Creation of the mandatory folders *
  • Docker folder should have been created by the Docker package, but just in case here are the commands to create it :

mkdir -p /volume1/docker/ chown root:root /volume1/docker

  • homebridge folder

mkdir -p /volume1/docker/<your_username>/homebridge

2 - Create a file named “dockerfile”

cd /volume1/docker/<your_username>/homebridge vi dockerfile


**** Basic commands to know in Vi ****


i : getting into Edition mode
ESC : getting out of Edition mode

When you’re out of edition mode :
dd : delete a line
ZZ : save the file with your modifications and get out of Vi
:q! : get out of Vi without saving the file

(French speaking people, you’ll find attached a memento about Vi commands).


Copy / Paste this content into the file :

[code]#########################################

DOCKERFILE POUR HOMEBRIDGE VERA

DOCKERFILE FOR HOMEBRIDGE VERA

#########################################

FROM debian:jessie

MAINTAINER tahitibub <tahitibub * gmail * com>

USER root

VARIABLES D’ENVIRONNEMENT

ENVIRONMENT VARIABLES

ENV DEBIAN_FRONTEND noninteractive

DEPOTS, MISES A JOUR & INSTALLATION DE LIBAVAHI

DEPOSITS, UPDATE and INSTALL OF LIBAVAHI

RUN \

apt-get update && \

apt-get install -y apt-utils nano &&
sed -i “s/exit 101/exit 0/” /usr/sbin/policy-rc.d && \

apt-get install -y
curl
wget
git
apt-transport-https
python
build-essential
make
g++
libavahi-compat-libdnssd-dev
libkrb5-dev
vim
net-tools

INSTALLATION DE NODE.JS

NODE.JS INSTALLATION

RUN \

curl -sLf -o /dev/null ‘https://deb.nodesource.com/node_0.12/dists/vivid/Release’ &&
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - &&
echo ‘deb Index of /node_0.12/ vivid main’ > /etc/apt/sources.list.d/nodesource.list &&
echo ‘deb-src Index of /node_0.12/ vivid main’ >> /etc/apt/sources.list.d/nodesource.list &&
apt-get update &&
apt-get install -y nodejs

INSTALLATION DE HOMEBRIDGE

HOMEBRIDGE INSTALLATION

#(LE PLUGIN VERA NECESSITE HOMEBRIDGE 0.2.13)
#(VERA PLUGIN NEEDS HOMEBRIDGE V0.2.13)
RUN
npm install -g homebridge@0.2.13 &&
npm install -g homebridge-vera

FINALISATION

FINALIZATION

USER root

(CORRECTION DU PROBLEME DBUS)

(DBUS PROBLEM FIX)

RUN rm -r /var/run && rm -r /var/lock && ln -s /run /var/run && ln -s /run/lock /var/lock && rm /run/dbus/*

EXPOSE 51826

CMD [“/root/.homebridge/run.sh”]

[/code]

3 - Building of the Docker image

cd /volume1/docker/<your_username>/homebridge/ docker build -t jessie-homebridge-vera .

4 - Creation of the configuration files

In your folder, you’ll have to create 2 configuration files :

  • config.json : configuration of homebridge (where you put your VERA’s IP)
  • run.sh : shell script that will be run by the container when you start the image

Here is the content of the “config.json” file :

[code]{
“bridge”: {
“name”: “Homebridge”,
“username”: “CC:22:3D:E3:CE:30”,
“port”: 51826,
“pin”: “031-45-154”
},

"description": "This is an example configuration file.",

"platforms": [
    {
        "platform": "Vera",
        "name": "Vera",
        "veraIP": "XXX.XXX.XXX.XXX",
        "includesensor": false,
        "securitypoll": 2000,
        "dimmertest": false        }
]

}
[/code]

You’ll have to replace “XXX.XXX.XXX.XXX” by your VERA’s IP address.

If needed, you can check your config.json file here.

Here is the content of the “run.sh” file :

[code]#!/bin/bash

MODIFICATION DES PARAMETRES DE AVAHI

AVAHI SETTINGS MODIFICATION

sed -i “s/rlimit-nproc=3/#rlimit-nproc=3/” /etc/avahi/avahi-daemon.conf
sed -i -e’/AVAHI_DAEMON_DETECT_LOCAL/s/1/0/’ /etc/default/avahi-daemon

LANCEMENT DES SERVICES DBUS, AVAHI, HOMEBRIDGE

RUNNING DBUS, AVAHI AND HOMEBRIDGE SERVICES

dbus-daemon --system
avahi-daemon -D
homebridge
[/code]

5 - Launching

You’ll have to enter this command :

docker run -d --net=host -p 51826:51826 -v /volume1/docker/<your_username>/homebridge:/root/.homebridge jessie-homebridge-vera

Let me know if you managed to do it !

Regards

Thanks for the guide.

I get the error:

Step 5 : RUN curl -sLf -o /dev/null
—> Running in xxxxxxxxx
curl: no URL specified!
curl: try ‘curl --help’ or ‘curl --manual’ for more information
INFO[0141] The command [/bin/sh -c curl -sLf -o /dev/null] returned a non-zero code: 2

Any thoughts ? TIA.

[quote=“synapse007, post:16, topic:190921”]Thanks for the guide.

I get the error:

Step 5 : RUN curl -sLf -o /dev/null
—> Running in xxxxxxxxx
curl: no URL specified!
curl: try ‘curl --help’ or ‘curl --manual’ for more information
INFO[0141] The command [/bin/sh -c curl -sLf -o /dev/null] returned a non-zero code: 2

Any thoughts ? TIA.[/quote]

Hi,

I just checked the “dockerfile” I published, and it is running well :

Step 5 : RUN curl -sLf -o /dev/null 'https://deb.nodesource.com/node_0.12/dists/vivid/Release' && curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && echo 'deb https://deb.nodesource.com/node_0.12 vivid main' > /etc/apt/sources.list.d/nodesource.list && echo 'deb-src https://deb.nodesource.com/node_0.12 vivid main' >> /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install -y nodejs ---> Running in xxxxxxxxx OK Hit http://security.debian.org jessie/updates InRelease Get:1 https://deb.nodesource.com vivid InRelease [3912 B] Get:2 http://security.debian.org jessie/updates/main amd64 Packages [261 kB] Get:3 https://deb.nodesource.com vivid/main Sources [768 B] Get:4 https://deb.nodesource.com vivid/main amd64 Packages [980 B] Ign http://httpredir.debian.org jessie InRelease Hit http://httpredir.debian.org jessie-updates InRelease Hit http://httpredir.debian.org jessie Release.gpg Get:5 http://httpredir.debian.org jessie-updates/main amd64 Packages [3619 B] Hit http://httpredir.debian.org jessie Release Get:6 http://httpredir.debian.org jessie/main amd64 Packages [9034 kB] Fetched 9304 kB in 26s (350 kB/s) Reading package lists... Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: rlwrap The following NEW packages will be installed: nodejs rlwrap 0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded. Need to get 7243 kB of archives. After this operation, 34.2 MB of additional disk space will be used.

Can you check, in your dockerfile, the ### NODE.JS INSTALLATION ### paragraph ?

If you don’t manage to correct it, I published a docker image (tahitibub/jessie-homebridge-vera).

Regards

very thanks good job :wink:

ok with dsm beta 6 :wink:

have you test openluup with docker ?

[quote=“davidd1205, post:18, topic:190921”]very thanks good job :wink:

ok with dsm beta 6 :wink:

have you test openluup with docker ?[/quote]
Thank you for your comment !

FYI, I just updated my tuto, adding a line into the “run.sh” file (which modify settings of Avahi daemon).

I’m sorry, but I’ve never heard about “openluup”. Can you explain what is it for ?

Regards

[quote=“tahitibub, post:19, topic:190921”][quote=“davidd1205, post:18, topic:190921”]very thanks good job :wink:

ok with dsm beta 6 :wink:

have you test openluup with docker ?[/quote]
Thank you for your comment !

FYI, I just updated my tuto, adding a line into the “run.sh” file (which modify settings of Avahi daemon).

I’m sorry, but I’ve never eard about “openluup”. Can you explain what is for ?

Regards[/quote]

hello

for openluip it 's here

http://forum.micasaverde.com/index.php/board,79.0.html

i have to test with docker image but not real success
it could to lighten my Veralite and use just the gateway to Zwave
but it was a question in case or in any case thank you to the docker with home bridge because I was passing on a debian vm under proxmox

very good job thanks