October 21, 2015 jensbouma

“Hello Siri turn the lights on!” The Siri for IOT bridge running on a Synology NAS

Okay, u have a iPhone maybe a Apple Watch and want Siri to control your smart-devices, when they aren’t compatible with Apple’s homekit but are compatible with IFTTT or a REST API for interfacing them with some PHP script, the solution is the HomeKit Bridge.

With this bridge u create virtual devices who interact with the real ones by calling their web adresses. In other words, almost all connected devices would be compatible.

Needing the new Philips Hue Hub to connect your light bulbs to homekit? No use the old one!

Do u have the new Hue bridge? Read this post about making rules for switching COCO with Hue dimmers.

If u use a home-automation platform already most of the platforms are supported: Domoticz, Fibaro, Philips Hue, Sonos, SmartThings etc. connect them to the bridge and they become Siri enabled homekit devices.

The following (Paid) App MyTouchHome I use to connect the virtual device and configure homekit. With this app u can change the names and organise the devices in zones and rooms and u can automate tasks by making scenes and schedules.

How to setup the server-side? The most ideal situation is using the server who is already present in the home network, for me is that my Synology DS1813+ NAS.

How to do this is described in the updated installation instruction where we use docker to run homebridge on the Diskstation.

http://jensbouma.nl/homebridge-in-a-docker-container-on-the-synology-diskstation-guide/
 

Warning!  The rest of this post is obsolete and there are beter options now!

 

I had a bit of struggle to get it working, but after i found the following instructions it was really easy to configure. Thanks to ACN on the VERA forum. Were using the Debian Chroot package because Docker will not work.

The updated installation instructions for DSM5.2

Add a custom source in your DSM: Package Centre > Settings > Package Sources

Name: SynoCommunity Location:  http://packages.synocommunity.com/

Search in the Package Centre for Python (the SynoCommunity version) and Chroot and install them both.

SSH to your Synology and go into the Chroot:
/var/packages/debian-chroot/scripts/start-stop-status chroot

Change the password:
passwd root

Setup Chroot with the installation script I made, see below for the source:
This will cost about 1 hour for downloading updates, installing and compiling the necessary updates and node.js and homekit. When asked for the locale settings use “en_US.utf8

Download the script:
wget downloads.jensbouma.nl/homebridgeinstall.sh
(it would be wise before running a downloaded script to exam what they will do, just use nano to look in to it)

Run the code:
. homebridgeinstall.sh

Install modules:
for example: npm install -g homebridge-http

Edit the config file with the devices u want to interface:

nano /root/.homebridge/config.json

Config would like something like this:
{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"
},
"accessories": [
{
"accessory": "Http",
"name": "Living Lamp",
"on_url": "https://[yourip]:[yourport]/[devicescript.php?relay=1]",
"off_url": "https://[yourip]:[yourport]/[devicescript.php?relay=2]",
"brightness_url": "https://[yourip]:[yourport]/[devicescript.php?dim=/%b]",
"http_method": "POST"
},
{
"accessory": "Http",
"name": "Kitchen Lamp",
"on_url": "https://maker.ifttt.com/trigger/[YOUR TRIGGER]/with/key/yourcustomapicode",
"off_url": "https://maker.ifttt.com/trigger/[YOUR TRIGGER]/with/key/yourcustomapicode",
"brightness_url": "https://maker.ifttt.com/trigger/[YOUR TRIGGER]/with/key/yourcustomapicode",
"http_method": "POST"
}
]
}

Check Github for more config options

Test if homebridge works and the config is right:
homebridge
(exit with ctrl + c)

Go back to the Synology console:
exit

Install startscript to synology for automatically startup on power-up

For easy start the HomeBridge I edit the (Airsonos, Thanks Marc to point to) startup script.
cd /usr/local/etc/rc.d/
wget downloads.jensbouma.nl/homebridge.sh
chmod 755 homebridge.sh
. /homebridge.sh start

Have fun with it!


For manual installation, here is the homebridgerun.sh script:
#update Debian to latest en setup
# use en_US.utf8 when asked
sed -i.`date +%Y%m%d` 's/fr.debian.org/au.debian.org/g' /etc/apt/sources.list
apt update -y
apt upgrade -y
apt install locales -y
dpkg-reconfigure locales
dpkg-reconfigure tzdata
apt install less vim curl rsync screen openssh-server bash-completion -y

#install needed packages
apt-get install build-essential -y
apt-get install nano -y
apt-get install cmake libboost-dev libboost-thread-dev libboost-system-dev libsqlite3-dev subversion curl libcurl4-openssl-dev libusb-dev zlib1g-dev libudev-dev -y
apt-get install apt-utils -y
apt-get install python -y
apt-get install git -y
apt-get install libavahi-compat-libdnssd-dev -y

#install node.js
cd /home/
git clone https://github.com/joyent/node.git
cd node
git checkout v0.12.4
./configure –openssl-libpath=/usr/lib/ssl
make
make install

#show version if working
node -v
npm -v

#install homebridge
cd /home/
git clone –recursive https://github.com/nfarina/homebridge.git
cd homebridge
nam install -g
#not sure if necessary
cd node_modules/HAP-NodeJS
nam install -g
cd –

# Fix the avahi deamon
/etc/init.d/dbus restart
apt-get install –reinstall avahi-daemon
service avahi-daemon start

the homebridge.sh script for /usr/local/etc/rc.d/ on the synology:
#!/bin/sh
#
# Put this file in /usr/local/etc/rc.d/homebridge.sh

case “$1” in

stop)
echo “Stop Homebridge …”
chroot /usr/local/debian-chroot/var/chroottarget su – root -c “/etc/init.d/dbus stop”
chroot /usr/local/debian-chroot/var/chroottarget su – root -c “/etc/init.d/avahi-daemon stop”
pkill -f homebridge
;;

start)
chroot /usr/local/debian-chroot/var/chroottarget su – root -c “/etc/init.d/dbus restart”
chroot /usr/local/debian-chroot/var/chroottarget su – root -c “/etc/init.d/avahi-daemon start”
nohup chroot /usr/local/debian-chroot/var/chroottarget su – root -c “/usr/local/bin/homebridge” >>/dev/null 2>>/dev/null &
;;

restart)
$0 stop
sleep 1
$0 start
;;

status)
ps | grep homebridge
return $?
;;

*)
echo “usage: $0 { start | stop | restart | status}” >&2
exit 1
;;

esac

 

Tagged:

Comments (82)

  1. w,vuyk

    Jens,

    Thanks a lot for your guidance in this. If I follow your instructions, I get the homebridge running once. But a new start gives me issues, making the software stop again. the only way out for me (am a linux nitwit) is creating a new instance of debian and do the setup again.
    I am seeing the following error at second start:

    /home/homebridge/node_modules/HAP-NodeJS/node_modules/mdns/lib/advertisement.js:56
    dns_sd.DNSServiceRegister(self.serviceRef, flags, ifaceIdx, name,
    ^
    Error: dns service error: unknown
    at Error (native)
    at new Advertisement (/home/homebridge/node_modules/HAP-NodeJS/node_modules/mdns/lib/advertisement.js:56:10)
    at Object.create [as createAdvertisement] (/home/homebridge/node_modules/HAP-NodeJS/node_modules/mdns/lib/advertisement.js:64:10)
    at Advertiser.startAdvertising (/home/homebridge/node_modules/HAP-NodeJS/lib/Advertiser.js:43:30)
    at Bridge.Accessory._onListening (/home/homebridge/node_modules/HAP-NodeJS/lib/Accessory.js:352:20)
    at HAPServer.emit (events.js:104:17)
    at HAPServer._onListening (/home/homebridge/node_modules/HAP-NodeJS/lib/HAPServer.js:153:8)
    at EventedHTTPServer.emit (events.js:104:17)
    at EventedHTTPServer. (/home/homebridge/node_modules/HAP-NodeJS/lib/util/eventedhttp.js:62:10)
    at Server.emit (events.js:104:17)

    Any ide how to get ast this, so I can just restart the process when needed?

    Wim

    • w,vuyk

      Jens,

      Sorry fir this message. Just found I need to restat the dbus and avahi service each time at a new start. Should have checked your script before 🙂

      The only challenge I have now is that mytouchhome just wont see the homebridge devices. They are showing correct with starting myhomebridge, but mytouchhome will just keep scanning. Do I need to open ports on the synology for this?

      Wim

      • jensbouma

        Wim, I have that same problem now. I think it is the bonjour broadcast to the network what is not coming true the default NAT in docker. I was trying to give the docker machine it’s own network adres in the same subnet as the synology by bridge the interface tot the real interface but i don’t have that working for now. Hope to fix this soon, it must be the ip range where the docker is operating.

  2. w,vuyk

    Jens,

    I have tested many scenarios here, opening all the bonjour ports in docker, with a one on one transition (no alternate port, but forwarding to the sam port in docker).
    Later I found that the homebridge is listening on port 51826. Opening this port in the docker image as well as explicitly enabling it on the firewall (although this should work as internally all ports were set to alllowed) did not work either.

    I would really love to have the homebridge on the synology nas, as I think it would have been the right place to be running. But as I also found a way to do this on windows, where my homeseer software is running, wich is controlling all my home automation so far. So I now have it running, homebridge is forwarding homekit commands to homeseer, and I can now tell siri what to do when I like it.
    Still want this to run on synology someday as I will then also move homeseer to synology, saving me a bit more energy on the homeseer machine 🙂

    If you find a solution, I would be very interested in it, but for now I am playing on windows to see how far it can control homeseer!

    • jensbouma

      I did some research too yesterday. For so far as I can see right now the Docker image only get a IPv6 adres. Still not found the solution to get the docker running in Host mode

    • jensbouma

      I updated the installation instructions with chroot instead of docker, this works fine now.

      • w.vuyk

        jens,

        Was trying your new instructions today and it seems I am almost at the finishline.
        I am struggling to get the avahi deamon to be started:

        Stopping system message bus: dbus.
        Starting system message bus: dbus.
        root@XXXXXXXX:/home/homebridge# service avahi-daemon start
        Starting Avahi mDNS/DNS-SD Daemon: avahi-daemonTimeout reached while wating for return value
        Could not receive return value from daemon process.
        (warning).

        That is how far I get. starting the homebridge then ends in error.

        Any idead how to get passed this point?

        • jensbouma

          Did u reinstall the deamon?

          # Fix the avahi deamon
          /etc/init.d/dbus restart
          apt-get install –reinstall avahi-daemon
          service avahi-daemon start

          • w.vuyk

            Yes, I ran the install script from your site. And tried it seperately also, without luck. It reinstalls with an error pointing to the homebridge btw and still tries to start the service itself?

            root@xxxxxxxx:/home/homebridge# apt-get install –reinstall avahi-daemon
            Reading package lists… Done
            Building dependency tree
            Reading state information… Done
            0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
            Need to get 0 B/90.4 kB of archives.
            After this operation, 0 B of additional disk space will be used.
            (Reading database … 38442 files and directories currently installed.)
            Preparing to unpack …/avahi-daemon_0.6.31-5_i386.deb …
            Unpacking avahi-daemon (0.6.31-5) over (0.6.31-5) …
            Processing triggers for man-db (2.7.0.2-5) …
            Processing triggers for dbus (1.8.20-0+deb8u1) …
            Processing triggers for systemd (215-17+deb8u2) …
            Setting up avahi-daemon (0.6.31-5) …
            Reloading system message bus config…done.
            insserv: warning: script ‘homebridge.sh’ missing LSB tags and overrides
            Restarting Avahi mDNS/DNS-SD Daemon: avahi-daemonTimeout reached while wating for return value
            Could not receive return value from daemon process.
            (warning).

          • w.vuyk

            Jens,

            Removed the Debian Chroot and redid the whole process here. It works now!
            you need to activate the S99homebridge.sh earlier in the process, wich probably caused my issue?

            On bug step into moving my Homeseer installation. I will mention you description also on the HS board.

            Thanks a lot!!

            Wim

      • dobsiin

        I’m now able to run the homebridge docker container on my synology nas. The trick was –net=host which is unfortunately only available when you ssh into your synology nas and run the container with the
        docker run -d –net=host -p 51826:51826 homebridge
        cmd there.

  3. Tim

    I am having the same problem too, it has sent me mad tonight, its a shame I did not read further down to these comments before I started.

    I am eager to hear if anyone has found a solution to this problem

    Thanks

    TIm

    • jensbouma

      I updated the installation instructions with chroot instead of docker, this works fine now.

  4. pakki

    Hi, is it possible to run this instruction on the synology DS211+?

    ../deps/v8/src/base/atomicops_internals_arm_gcc.h:258:4: error: #error “Your CPU’s ARM architecture is not supported yet”
    # error “Your CPU’s ARM architecture is not supported yet”

    kind regards

    pakki

      • Julien

        It won’t. All Synology x11 series (I have a DS211j almost identical to pakki’s) have an ARMv5 processor, model Marvell Kirkwood mv6281. Those NAS are stuck with Node.js 0.10, whereas nfarina’s HomeBridge needs Node.js version 0.12 minimum. So unfortunately our NAS are incompatible.

        I tried and also got:
        ../deps/v8/src/base/atomicops_internals_arm_gcc.h:258:4: error: #error “Your CPU’s ARM architecture is not supported yet”

        node 0.12 does not compile. Too bad 🙁

  5. Barry

    Hi Jens,

    Thanks for your revised post. I’m following these instructions now. Just a note to say thank you for sharing this. As well, I wanted to point out that the download link to your script files is broken and that you have got a typo in that your downloadable script is titled homebrigerun.sh whilst your instructions to run it refer to a script titled homekitrun.sh
    Cheers,
    Barry

  6. Barry

    Hi Jens,

    When setting up the avahi daemon, the script returns a couple of errors:

    Setting up dbus (1.8.20-0+deb8u1) …
    Failed to read /proc/cmdline. Ignoring: No such file or directory
    [FAIL] Can’t start system message bus – /proc is not mounted … failed!

    Failed to read /proc/cmdline. Ignoring: No such file or directory
    [….] Reloading system message bus config…Failed to open connection to “system” message bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
    invoke-rc.d: initscript dbus, action “force-reload” failed.
    Failed to read /proc/cmdline. Ignoring: No such file or directory
    [FAIL] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon failed!

    It looks like dbus fails to setup due to missing the /proc and /var directories in my chroot environment. I may have to mount these directories to my environment (and remount after a reboot) but don’t know how. Did you happen to fix this in the process of setting up your chroot environment – or is this issue exclusive to my system?

    Any advise you’d be able to give me is greatly appreciated.
    Cheers,
    Barry

  7. Dear Jens,

    I have followed the instructions and as far as I can tell everything worked oke, until the last line.
    Then I receive the error below. I have googled the missing script error, but can’t find a solution.

    I hope your able to help!

    root@DiskStation:/home# . /etc/init.d/homebridge.sh start
    [ ok ] Stopping system message bus: dbus.
    [ ok ] Starting system message bus: dbus.
    [ ok ] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon.
    npm ERR! Linux 3.2.40
    npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “run” “start”
    npm ERR! node v0.12.4
    npm ERR! npm v2.10.1

    npm ERR! missing script: start
    npm ERR!
    npm ERR! If you need help, you may report this error at:
    npm ERR!

    npm ERR! Please include the following file with any support request:
    npm ERR! /home/homebridge/npm-debug.log
    root@DiskStation:/home/homebridge#

    Last part of npm-debug.log:
    0 info it worked if it ends with ok
    1 verbose cli [ ‘/usr/local/bin/node’, ‘/usr/local/bin/npm’, ‘run’, ‘start’ ]
    2 info using npm@2.10.1
    3 info using node@v0.12.4
    4 verbose stack Error: missing script: start
    4 verbose stack at run (/usr/local/lib/node_modules/npm/lib/run-script.js:1$
    4 verbose stack at /usr/local/lib/node_modules/npm/lib/run-script.js:58:5
    4 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-packag$
    4 verbose stack at handleExists (/usr/local/lib/node_modules/npm/node_modul$
    4 verbose stack at FSReqWrap.cb [as oncomplete] (evalmachine.:22$
    5 verbose cwd /home/homebridge
    6 error Linux 3.2.40
    7 error argv “/usr/local/bin/node” “/usr/local/bin/npm” “run” “start”
    8 error node v0.12.4

    • jensbouma

      Did you run the homebridge.sh on the chroot? Or at the Diskstation?

      Did u try at the chroot the commands without using the script? Looks like the script it’s trying to start it in the wrong root.

      • Hi Jens,

        I have tried both… From the prompt in chroot, outside Chroot (Ssghomebridge.sh) and from the diskstation (Debian Chroot, add service).
        Only the Chroot version gives back this data to use.

        Ssghomebridge.sh
        DiskStation> . Ssghomebridge.sh
        failed: No such file or directory@appstore/debian-chroot/var/chroottarget/proc
        : not foundmebridge.sh: line 5: }
        : not foundmebridge.sh: line 6:
        : not foundmebridge.sh: line 9: }
        : not foundmebridge.sh: line 10:
        -ash: Ssghomebridge.sh: line 11: syntax error: unexpected word (expecting “in”)

        Manually starting the scriptlines results in the same error as in Chroot.

        DiskStation> mount -o bind /proc /volume1/@appstore/debian-chroot/var/chroottarg
        et/proc
        DiskStation> chroot /volume1/@appstore/debian-chroot/var/chroottarget /etc/init.
        d/homebridge.sh start
        [ ok ] Stopping system message bus: dbus.
        [ ok ] Starting system message bus: dbus.
        [ ok ] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon.
        npm ERR! Linux 3.2.40
        npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “run” “start”
        npm ERR! node v0.12.4
        npm ERR! npm v2.10.1

        npm ERR! missing script: start
        npm ERR!
        npm ERR! If you need help, you may report this error at:
        npm ERR!

        npm ERR! Please include the following file with any support request:
        npm ERR! /home/homebridge/npm-debug.log

        Test from the directory: /etc/init.d/

        root@DiskStation:/etc/init.d# . homebridge.sh start
        [ ok ] Stopping system message bus: dbus.
        [ ok ] Starting system message bus: dbus.
        [ ok ] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon.
        npm ERR! Linux 3.2.40
        npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “run” “start”
        npm ERR! node v0.12.4
        npm ERR! npm v2.10.1

        npm ERR! missing script: start
        npm ERR!
        npm ERR! If you need help, you may report this error at:
        npm ERR!

        npm ERR! Please include the following file with any support request:
        npm ERR! /home/homebridge/npm-debug.log

        Stuff in the homebridge dir:

        root@DiskStation:/home/homebridge# dir
        bin config-sample.json lib node_modules package.json
        config.json example-plugins LICENSE npm-debug.log README.md
        root@DiskStation:/home/homebridge#

        I redid the whole installation manually, resulted in the same error.
        I removed Debian Chroot and did it over again, same result.

        When I Google the error, it points to a missing ‘start’ script in package.sjon?

        I think I found at least one error in the script.
        “cd node_modules/HAP-NodeJS” should be “cd node_modules/hap-nodejs” right?

        I only errors I saw/noticed where during the install of npm.

        perl: warning: Setting locale failed.
        perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = “en_US.utf8”,
        LANG = “en_US.utf8”
        are supported and installed on your system.
        perl: warning: Falling back to the standard locale (“C”).
        locale: Cannot set LC_CTYPE to default locale: No such file or directory
        locale: Cannot set LC_MESSAGES to default locale: No such file or directory
        locale: Cannot set LC_ALL to default locale: No such file or directory
        E: Can not write log (Is /dev/pts mounted?) – posix_openpt (2: No such file or d irectory)
        (Reading database … 38169 files and directories currently installed.)

        Hope this helps, please tell me what you need to debug!

  8. Sebastien D

    Hi Axel,

    I have exactly the same issue. Have you been able to solve it ?

    thanks in advance.

    regards,
    SD

    • Hi Sebastien,

      No not yet, I don’t seem to get by this problem.
      Waiting for a respons of Jens to take the next step in problem analysis/solving.
      What kind of HW do you use?
      I have a synology DS414 (Armadaxp processor)

      Kind regards,
      Axel

  9. jensbouma

    Try ‘node app.js’ instead of ‘npm run start’, it looks like the homebridge repository is changed. I have the same errors at the moment. I don’t now if the ARM processor is supported already, the node.js version was not updated yet told Julien earlier.

  10. Hi Jens,

    This is what I get from running “node app.js”

    root@DiskStation:/# node app.js
    module.js:338
    throw err;
    ^
    Error: Cannot find module ‘/app.js’
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

    So I searched for app.js and then ran it from that directory

    root@DiskStation:/# node ./home/node/test/fixtures/clustered-server/app.js
    all workers are running

    Is this what is to be expected?

  11. Hi all,

    I got inpatient with getting the Homebridge running on the Synology, so I installed it on my Raspberry Pi.
    The funny thing is, I experienced the same (kind of) errors when running it, see below…

    npm ERR! Linux 4.1.7-v7+
    npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “run” “start”
    npm ERR! node v0.12.1
    npm ERR! npm v2.5.1
    npm ERR! code ELIFECYCLE
    npm ERR! homebridge@0.0.0 start: `node app.js`
    npm ERR! Exit status 1

    But… The application is running! And I see devices (used the sample file) on my iPhone.
    Would be nice though to see whats is wrong… So I deleted Chroot again and will start over 🙂

    • jensbouma

      It seems that they changed the repo to a global installation type https://github.com/nfarina/homebridge and they say that the RPI installation is not working yet.

      I edited the installation scripts with the following:
      – The installation of homebridge is now global.
      – The path for the config.json is changed.
      – The startup script is corrected.

      After this changes my installation is working again.

  12. Hi Jens,

    I will try your new script, when did you change it? Script is running on my Synology right now, since 17:21.

    There is also a small issue in the config.sjon script.
    The “,” on line 23 has to go.

    I got it running on my RPI using this config.sjon
    {
    “description”: “Configuration file for Domoticz platform.”,
    “platforms”: [
    {
    “platform”: “Domoticz”,
    “name”: “Domoticz”,
    “server”: “127.0.0.1”,
    “port”: “8080”
    }
    ],
    “accessories”: []
    }

    Kind regards,
    Axel

    • jensbouma

      I changed it a few minutes ago. So after the install. Install homebridge again with ‘npm install -g homebridge’ for running the node use ‘homebridge’ as it is global now.

  13. There was a problem reading your config.json file.
    Please try pasting your config.json file here to validate it: http://jsonlint.com

    /usr/local/lib/node_modules/homebridge/lib/server.js:124
    throw err;
    ^
    SyntaxError: Unexpected token ]
    at Object.parse (native)
    at Server._loadConfig (/usr/local/lib/node_modules/homebridge/lib/server.js:118:19)
    at new Server (/usr/local/lib/node_modules/homebridge/lib/server.js:25:23)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:23:3)
    at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)

    But after editing config.sjon (revoving the “,”)

    Loaded plugin: homebridge-http
    Registering accessory ‘homebridge-http.Http’

    Loaded config.json with 2 accessories and 0 platforms.

    Loading 2 accessories…
    [Living Lamp] Initializing Http accessory…
    [Kitchen Lamp] Initializing Http accessory…
    Scan this code with your HomeKit App on your iOS device to pair with Homebridge:

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

    Homebridge is running on port 51826.

    Seems to work!

  14. Sebastien D

    Hello,

    thanks to your help I have managed to install homebridge and make it work !!!
    The only bug I had was that some of my zwave accessories had the same name in Home Center, which is not acceptable for homebridge. So I renamed a few of them and it worked !

    Now I am fighting to make it start automatically, and overall, make it run without an open SSH window !!! And I don’t know how to do….

    Could you please help me ? You talked about ‘screen’ but I don’t know what it is.

    Thanks again, and thanks in advance.

    Sebastien

    • jensbouma

      Screen is a ipkg install. I installed it with iPKGui package in DSM. It runs with ‘screen’ in SSH terminal. start the homebridge commands in this screen and detach with ctrl+a and then d. If u want to re-attach the screen use ‘screen -r’

      • Hi Jens,

        The Screen option does not seem to work in my situation.
        Is there a way to add the script to the Debian Chroot App in DSM?

        Greetings,
        Axel

        • I just tried to get the screen option to work aswell. i have screen installed with ipkg and I screen then I start the home bridge command and then I detach and when I close the SSH connection the server stops I also tried using a crontab @reboot that didn’t work either. not sure what to do.

          • correction the screen option is running it in the background and as long as I don’t reboot it stays up.

  15. I followed your guide as best I could and got everything installed but It will now start home bridge when I type home bridge it crashes immediately and I don’t know why it can’t bind.

    tis is the error I get when running it with node v 4.0.0 which is what home bridge uses for its raspberry pi instructions.

    root@owlscloud:/homebridge# homebridge
    *** WARNING *** The program ‘node’ 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
    *** WARNING *** The program ‘node’ 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
    Loaded plugin: homebridge-harmonyhub
    Registering platform ‘homebridge-harmonyhub.HarmonyHub’

    Loaded plugin: homebridge-wink
    Registering platform ‘homebridge-wink.Wink’

    Loaded config.json with 0 accessories and 3 platforms.

    Loading 3 platforms…
    [Blaines Harmony] Initializing HarmonyHub platform…
    [Blaines Harmony] Searching for Logitech Harmony remote hubs…
    [Harmony Hub living room] Initializing HarmonyHub platform…
    [Harmony Hub living room] Searching for Logitech Harmony remote hubs…
    [Wink] Initializing Wink platform…
    [Wink] Fetching Wink devices.
    events.js:141
    throw er; // Unhandled ‘error’ event
    ^

    Error: bind EADDRINUSE 0.0.0.0:5224
    at Object.exports._errnoException (util.js:837:11)
    at exports._exceptionWithHostPort (util.js:860:20)
    at dgram.js:213:18
    at doNTCallback3 (node.js:440:9)
    at process._tickCallback (node.js:346:17)
    at Function.Module.runMain (module.js:477:11)
    at startup (node.js:117:18)
    at node.js:951:3

    wish I knew how to fix it.

  16. Jordan

    Tried to follow the directions just now, but the debian chroot came with this in the apt/sources.list:

    deb http://debootstrap.invalid/ jessie main

    Obviously that won’t work, manually changed it to a local mirror first to get it to work (if anyone else is having similar trouble)

    Even after that I still had some trouble and had to manually run the apt update and apt install a few times before they completed successfully and everything else would run. Not sure what that last was due to.

  17. Remco

    Hi Jens, i am a not a coder, so sorry if my question seems silly. In the Synology package center there is also a node.js package (version 0.12.6 for my DS214+) that can be installed, can this one also be used?

    • jensbouma

      Maybe it’s compatible right now, I used chroot because it wasn’t. Just give it a try without the install scripts, like to hear if it works.

    • Jordan

      It’s not when I tried it before I found this blog. npm install failed due to some dependency not compiling, I didn’t troubleshoot it very far

  18. Hi! I’ve been finding a way to connect some devices with HomeKit, and a found this promising post about homebridge on a Synology Server:
    I’m using a DS213j – MARVELL Armada 370, running BusyBox v1.16.1, Python 2.7.11, Debian Chroot 8.1-6

    —When i try to SSH the Chroot i get this message:
    /var/packages/debian-chroot/scripts/start-stop-status chroot
    bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)

    —I ignored the message and keep up with the installation:
    wget downloads.jensbouma.nl/homebridgeinstall.sh

    —after almost 5 Hrs I got a Warning message (and a bunch of errors):
    (warning).
    [….] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemonTimeout reached while wating for return value
    Could not receive return value from daemon process.
    (warning).

    —If i try to install a plugin, i got this:
    npm install -g homebridge-philipshue
    -ash: npm: not found

    —So it seems it’s something about the config.json, but mi nano does not seem to work!
    nano /root/.homebridge/config-sample.json
    -ash: nano: not found

    I really like the idea of HomeBride, but i have little knowledge with code; On this link you can find the Log file of the installation;
    https://www.dropbox.com/s/bn5tu7bigsbfgac/Failed%20HomeBridge%20Install.rtf?dl=0

    Please Help Me Obi Wan Kenobi!
    Thanks in advanced and Happy New Year from Mexico 🙂

    • jensbouma

      It seems that it don’t work with ARM cpu’s at the moment, there where multiple comments about that.

    • kubax

      Hi Clemens,
      I have exacly the same problem and the same Diskstation. Do you already found a solution?

      @Jens: Thanks for this great work. A friend of mine is running your system and it’s working perfectly well. If you have an idea how I can run Homebridge on my DS213j, please let me know.

      Cheers

  19. Tigo

    Hi Jens,

    Following your instructions, I’ve got the Homebridge up and running on my Synology. Start and restart works, autstart on boot works, The Homebridge startup log tells me Hue and Domoticz platforms are being recognized, accessories are registered. Great work!

    Yet, when I try any app on my iphone (ios 9.2.1), like Eve or Insteon+, it finds the Homebridge but it does not recognize the accessories. Also, I do not get the opportunity to enter the pin. So I can tap Homebridge and that’s it. No pairing, no accessories.

    I had the same issue when installing Homebridge through a docker – again the bridge is working, yet accessories are not found in the app. Going to an earlier ios on my iPad gave the same experience.

    I’ve changed username, bridge name, cleared persist folder, reinstalled nodejs, did several other tweaks, but to no avail. I’m now back on the original configuration as presented in this blog.

    Has anyone had a similar experience; and even more interesting: does anyone have a suggestion for a solution?

    • jensbouma

      Did you try to remove your homekit setting? And reset it when you removed the settings?

      • Tigo

        Thanks for your reply, Jens. Yes, I went to homekit > privacy > reset configuration, as well as to homekit > remove homes. In fact, I did that several times. No luck however.

  20. Ryan Maxwell

    Thank you so much for the guide/script, it saved me so much hassle. PS @James Cocker the package is now called “Debian Chroot”

  21. Kev

    Such a great blog post unbelievably helpful! For anyone who had trouble with this error:

    [ ok ] Stopping system message bus: dbus.
    [FAIL] Can’t start system message bus – /proc is not mounted … failed!
    [FAIL] Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon failed!

    It can be fixed by mounting /proc in the chroot environment:

    mount -t proc none /proc

  22. Daniel

    Jens,
    thank you for your great work!

    I have a little question… Homebridge is running on Port 51826… Loaded 1 accessory..
    Eve App is startet and Homebridge is displayed. If I click on it, a message it’s shown, that the device it’s not certified. After click on “nevertheless add” it’s loading but no window for code opening.
    I tried different apps but no changes.
    Maybe a hing for me? Some help what I can test to get it working?

    • Daniel

      done … after I wrote this, I remembered the Port. Exception in the firewall, running… 🙂

  23. Sebastian

    I have problems setting up the start script:

    admin@DiskStation:/$ cd /usr/local/etc/rc.d/
    admin@DiskStation:/usr/local/etc/rc.d$ wget downloads.jensbouma.nl/homebridge.sh
    –2016-05-26 19:02:32– http://downloads.jensbouma.nl/homebridge.sh
    Resolving downloads.jensbouma.nl… 31.186.169.8
    Connecting to downloads.jensbouma.nl|31.186.169.8|:80… connected.
    HTTP request sent, awaiting response… 200 OK
    Length: 818 [application/x-sh]
    homebridge.sh: Permission denied

    Cannot write to ‘homebridge.sh’ (Permission denied).
    admin@DiskStation:/usr/local/etc/rc.d$ chmod 755 homebridge.sh
    chmod: cannot access ‘homebridge.sh’: No such file or directory
    admin@DiskStation:/usr/local/etc/rc.d$ . /homebridge.sh start

    Any ideas?

  24. Sebastian

    I managed to download the start script but I cannot run the last command “. /homebridge.sh start”. I always get the error “No such file or directory”. I checked with “ls” and it does list the file in the folder. However, each time I try to run it I get the error that it does not exist… very strange.

    And another thing. I set up and started everything through Terminal on Mac. Homebridge runs smoothly but as soon as I close Terminal, home bridge stops working. As I understand it, homebridge should run on the Diskstation and therefore, it shouldn’t matter if I close Terminal on the Mac, right? If not, can anyone explain to me, how it exactly works, please?

    Thanks!

  25. Frank

    Great that you have made this all available! Thanks!

    HomeBridge does start for me, but I cannot find it using iOS, this is the error I get:

    Error: dns service error: unknown
    at Error (native)
    at new Advertisement (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/node_modules/mdns/lib/advertisement.js:56:10)
    at Object.create [as createAdvertisement] (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/node_modules/mdns/lib/advertisement.js:64:10)
    at Advertiser.startAdvertising (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Advertiser.js:43:30)
    at Bridge.Accessory._onListening (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:510:20)
    at HAPServer.emit (events.js:104:17)
    at HAPServer._onListening (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:182:8)
    at EventedHTTPServer.emit (events.js:104:17)
    at EventedHTTPServer. (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/util/eventedhttp.js:62:10)
    at Server.emit (events.js:104:17)

    Besides that it also gives met this error if I try to start dbus:
    [FAIL] Can’t start system message bus – /proc is not mounted … failed!

    Any help would be much appreciated.

  26. Menno

    Hee Jens,

    Ik heb geprobeerd je script te runnen. Het lijkt goed te gaan totdat hij de packages moet installeren.

    Rsync, bash-completion, vim, build essential, sliblg-dev, cmake, libboost-dev, libboos-system-dev, libusb-dev , geven de volgende melding: “package is not available, but is referret to by another package. this only may mean that the package is missing, has been obsoleted, or is only available form another source.

    Daarna geven dezelfde packages de melding: “E: Package ” has no installation candidate.

    De rest van het script gaat verkeerd door bovenstaande melding. Ken jij een oplossing hiervoor?

  27. I have tried following the procedure here: https://github.com/oznu/homebridge-syno-spk#how-to-install (Synology Package for Homebridge Docker) but the Home app does not find Homebridge. I suspect it has to do with port 51826, as I simply do not know where to open this port… I am a complete idiot about this; is it done on the home router, on the Synology, or where?

    I try https://www.yougetsignal.com/tools/open-ports/ to test and it says the port is closed.

    Any help is much appreciated!

    • jensbouma

      I didn’t know there is a DSM package now to install the docker image, interesting!

      I’m not sure what your problem is.

      – Did you installed the Docker application? The homebridge container should be running in there after installing it.

      – You can go to the config-page and check the logs. Is the configuration okay and is it starting up and does it keeps running? You need to install also the plugins you using in your config file.

      – The phone has to be connected in the same network as the Synology. With the Wifi Router’s LAN port connected to the Synology it should work when the router is configured normally. Please check if network isolation is turned in the router.

      I did my last installation about 2 years ago with the Docker application:
      https://jensbouma.nl/homebridge-in-a-docker-container-on-the-synology-diskstation-guide/

Leave a Reply

Your email address will not be published. Required fields are marked *