Skip to content

Homebridge on LEDE/OpenWRT routers

What is Homebridge?

Homebridge is a lightweight NodeJS server you can run on your home network that emulates the iOS HomeKit API

– From Homebridge Github

Homebridge can act as iOS HomeKit API provider at your home, enabling adding devices unsupported by Apple HomeKit.
Having a smart home solution can be very easy with Homebridge and many other smart devices.

In many cases found on the Internet, Homebridge is installed on Raspberry Pi or a dedicated Linux server, which is much easier to setup comparing to a router.
Routers have limited RAM, disk space and the the worst one – lack of many packages and libraries needed by Homebridge.

Before starting, read Homebridge’s Github Repo to get more info.


A wifi router

  • having more than 300MB free space, the whole installation consumed around 250MB or more, config extroot to get lager space if needed.
  • having more than 50MB of free RAM, Homebridge consumes about 50MB of RAM.
  • running LEDE or OpenWRT or other router distribution having richer packages or resources. I have succeed on LEDE.

And also

  • Cross-compile toolchain for your router architecture.
    libpthread.a for your router architecture if you can’t find one in router /usr/lib
  • Passion, and patience


  • Zyxel NBG-6817 Wifi Router, 512MB RAM, 4G eMMC internal storage.
  • LEDE Reboot 17.01.4
  • Snapshot opkg package source

I have only tested on LEDE, but I think OpenWRT can also be fine.

2018.05.05 UPDATE:  LEDE is now merged back to OpenWRT.


Method 1 – Make as Built-in from ROM source

If you are making your ROM from the source code. You can add 3rd-party node repo source and have Homebridge option in menuconfig and compile it with your ROM. Check the Repo

Method 2 – Install on router

First, Make sure your opkg is up to date by running

opkg update

Second, Install make tools from opkg, gcc, libavahi-compat-libdnssd and make is needed

opkg install gcc make libavahi-compat-libdnssd

Actually we need the package libavahi-compat-libdnssd-dev which contains the header file dns_sd.h, but opkg does not provide the package, so download dns_sd.h here and put it in
or maybe
can depends on different routers.

Then, Install node, npm from opkg, and install node-gyp with npm

opkg install node node-npm
npm install -g node-gyp

Next, We need the cross-compiled libpthread.a when compiling node-mdns, which is a dependency to Homebridge.

If you can’t find libpthread.a in /usr/lib, you’ll have to cross-compile one. Please find out the LEDE/OpenWRT source code for your device.
Follow the official guide to build the library 

when doing make menuconfig, do select Package the LEDE-Base Toolchain

After building the image, you will find your cross-compiled  libpthread.a  at
/path/to/lede/source/staging_dir/toolchain-[YOUR ARCH]/lib/libpthread.a
copy it to  /usr/lib on the router.

Finally, we have all the dependencies, use npm to install HomeBridge

npm install -g homebridge

if getting cc not found, make cc soft link to gcc.

Check by running


If everything works fine, now Homebridge is installed on the router, refer to Homebridge’s Github Repo for further plugin setup.

Auto start on boot (init.d)

I write a simple init.d script which works fine on my wifi router.

Download and put it in /etc/init.d

chmod +x /etc/init.d/homebridge
/etc/init.d/homebridge enable
/etc/init.d/homebridge start

Be First to Comment

Leave a Reply

Your email address will not be published.