Setup Homebridge on Synology NAS without Docker
Last weekend I got the IKEA TRÅDFRI kit for my new lamps. It worked OK initially but the app could not connect to gateway after done setup. Since Homekit has always being on my TODO list and controlling lights thru app isn’t quite convenient anyway, I figure it is time to give Homebridge a try.
There are couple docker images. If you have a powerful NAS (prob x86), then Docker is definitely the way to go. But if your are like me, whose NAS doesn’t support Docker and don’t want to setup another 24/7 Raspberry Pi, here is how to setup one without Docker.
Setup Debian Chroot
Why? The native DSM environment doesn’t have required dependency and services. They are not available thru Package Center nor OPKG (aka Entware-ng). With Debian Chroot, you get full
- Add SynoCommunity as Package Center source by following https://synocommunity.com/
- Install Debian Chroot from Package Center
- SSH to your NAS
Now you are ready to roll.
The distributed node wasn’t working for me, so I built my own. If
apt-get install node can gets you a working version of node, then you can skip this part.
- Find a working dir.
cd ~will work fine.
apt-get install build-essential
wgeta node tarball from https://nodejs.org/dist/. Recommend
tar -zxvf <node-tar-filename>
- Enter the unpacked node dir.
makeYou can add
-j2to the command if you have dual cores. Even
-j4if you have four cores.
- It will take a while to complete.
Install and start dependencies
apt-get install libavahi-compat-libdnssd-dev git
If the last two command failed, try
mount -t proc proc proc/ first.
npm install -g --unsafe-perm homebridge
- Then install an plugins you need
npm install -g --unsafe-perm homebridge-<plugin_name>
homebridgeit should starts now!
You can follow the instruction in https://github.com/nfarina/homebridge#installation to finish your setup.
Now you can simply run
homebridge in a
screen session to keep it running in the back.
Setup Homebridge as service
Or you can setup it as a service that can auto start after reboots.
- Add a user for the service
useradd -s /bin/false -b /var/run homebridge
- Copy your
.homebridgedir to the new home
cp -R ~/.homebridge /var/run/homebridge
- Download the content of https://gist.github.com/gregwym/d7b31606758acfb61896f588d13c3dda into
chmod a+x /etc/init.d/homebridge
service homebridge startDone!
Finally, you can set it to start automatically after reboot in the Debian Chroot DSM UI. On DSM 6, you may need to fix it first by following https://github.com/SynoCommunity/spksrc/issues/1910#issuecomment-253990371.
Add services into Debian Chroot UI as the screenshot bellow, then your homebridge should be all automated now. Cheers.