We have moved at community.getvera.com

Author Topic: Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology  (Read 49210 times)

Offline tahitibub

  • Sr. Newbie
  • *
  • Posts: 35
  • Karma: +3/-0
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.
« Last Edit: February 18, 2016, 01:54:18 pm by tahitibub »

Offline PrBreezy

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-1
Re: Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology
« Reply #1 on: February 05, 2016, 02:48:55 am »
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

(http://s11.postimg.org/dxl1urb9f/Capture.png)

Offline PrBreezy

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-1
Re: Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology
« Reply #2 on: February 05, 2016, 06:24:09 am »
You forget to add :

" Map all ports automatically "

I think this is required as well.

Offline tahitibub

  • Sr. Newbie
  • *
  • Posts: 35
  • Karma: +3/-0
Re: Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology
« Reply #3 on: February 05, 2016, 11:26:03 am »
You forget to add :
" Map all ports automatically "
I think this is required as well.

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

Offline tahitibub

  • Sr. Newbie
  • *
  • Posts: 35
  • Karma: +3/-0
Re: Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology
« Reply #4 on: February 05, 2016, 11:28:56 am »
Hi,
Thank you for your thread !

Hi,

Quote
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.
« Last Edit: February 05, 2016, 11:35:15 am by tahitibub »

Offline C7Z51

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +2/-2
Re: Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology
« Reply #5 on: February 05, 2016, 11:44:32 pm »
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:

Code: [Select]
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.

Offline C7Z51

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +2/-2
Re: Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology
« Reply #6 on: February 05, 2016, 11:53:27 pm »
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/
« Last Edit: February 06, 2016, 12:04:58 am by C7Z51 »

Offline PrBreezy

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-1
Re: Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology
« Reply #7 on: February 06, 2016, 05:25:18 am »
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:
- Node.js,
- Git,
- Git Server,
- Python,
- Java 8 (from this source for example : http://packages.pcloadletter.co.uk/)

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.





Offline C7Z51

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +2/-2
Re: Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology
« Reply #8 on: February 06, 2016, 08:09:10 am »
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.
« Last Edit: February 06, 2016, 01:35:24 pm by C7Z51 »

Offline tahitibub

  • Sr. Newbie
  • *
  • Posts: 35
  • Karma: +3/-0
Re: Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology
« Reply #9 on: February 06, 2016, 11:52:42 pm »
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).

Code: [Select]
/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.

Code: [Select]
mkdir -p /volume1/docker/homebridge
chown root:root /volume1/docker/homebridge

Then, the container can be run using this script :

Code: [Select]
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 ...
« Last Edit: February 07, 2016, 05:00:52 pm by tahitibub »

Offline tahitibub

  • Sr. Newbie
  • *
  • Posts: 35
  • Karma: +3/-0
Re: Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology
« Reply #10 on: February 08, 2016, 06:10:13 pm »
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.
« Last Edit: February 08, 2016, 06:13:34 pm by tahitibub »

Offline Spudz72

  • Full Member
  • ***
  • Posts: 103
  • Karma: +0/-0
Re: Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology
« Reply #11 on: February 08, 2016, 08:35:03 pm »
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.

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! 👍

Offline PrBreezy

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-1
Re: Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology
« Reply #12 on: February 11, 2016, 03:56:27 pm »
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 !

Offline tahitibub

  • Sr. Newbie
  • *
  • Posts: 35
  • Karma: +3/-0
Re: Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology
« Reply #13 on: February 13, 2016, 04:23:30 pm »
Hi everybody,

After many attempts, I finally managed to do it!

I will explain here how to do tomorrow.

Regards

Offline tahitibub

  • Sr. Newbie
  • *
  • Posts: 35
  • Karma: +3/-0
Re: Installing HomeBridge (HomeKit bridge to Vera) on Docker Synology
« Reply #14 on: February 15, 2016, 02:04:28 am »
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 *
Code: [Select]
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 :
Code: [Select]
mkdir -p /volume1/docker/
chown root:root /volume1/docker

- homebridge folder
Code: [Select]
mkdir -p /volume1/docker/<your_username>/homebridge


2 - Create a file named "dockerfile"

Code: [Select]
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: [Select]
#########################################
#    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 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



### 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"]                                                                           



3 - Building of the Docker image


Code: [Select]
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: [Select]
{
    "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        }
    ]
}

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: [Select]
#!/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


5 - Launching

You'll have to enter this command :

Code: [Select]
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
« Last Edit: February 19, 2016, 03:03:29 pm by tahitibub »