Homebridge: Homekit without Homekit hardware

Shot of the lights outside

We have a few WIFI-connected devices here at Casa Wise - AppleTV, printers and the like, and also a few Belkin WeMo switches which we use for outdoor lighting. We needed remotely switched lights mostly as it would defeat the purpose to walk to the studio to turn the light on, on the path TO the studio....

WeMo devices aren't outdoor-safe, but with the addition of some IP77 electrical boxes and some silicone sealer, these ones are now!

The WeMo is pretty functional on it's own - you can turn it on and off via your phone, either on your network or off, or via IFTTT, they self-update, and they have a very functional timer, which includes things like "turn on 30 mins before sunset", adjusting for each days sunset in your timezone.

At it's heart its just a small Linux box with a wifi card, controlling a relay to turn the power on and off. They are not perfect, but they are a nice little device.


One thing they are not, however, is HomeKit compatible. I'm not sure what has kept Belkin[1], as the spec has been out for over a year, and other companies have released a fair bit of hardware, but where there's a gap, there's usually an open source way.

Enter Homebridge.


Homebridge is a Node app which acts as a HomeKit bridge, with a long, long list of things which can plug into it. It covers WeMo (thanks!), IFTTT, basic HTTP(S) connections, SSH, Philips Hue, Lockitron, SSH and lots of others.

It's pretty easy to install. Just install Node (I used nvm), then install homebridge

sudo npm install -g homebridge

(yes, the sudo and -g matter!). This works on a Mac and on Linux (including RPi), and I'd assume on Windows too.

... install some plugins:

sudo npm install -g homebridge-wemo

... setup your config. Mine is 3 WeMos, but the accessories section is the only bit I've done anything to over the default config.

{
  "bridge": {
    "name": "Homebridge",
    "username": "CC:22:3D:E3:CE:30",
    "port": 51826,
    "pin": "031-45-154"
  },
    
  "description": "Hillside Road config",
  "platforms": [
    ],
  "accessories": [
    {
      "accessory": "WeMo",
      "name": "Cabin Lights",
      "description": "Light switch on the boardwalk, at the cabin end.",
      "wemo_name": "cabin lights"
    },
    {
      "accessory": "WeMo",
      "name": "Deck Lights",
      "description": "Light switch on the boardwalk, at the house end",
      "wemo_name": "deck lights"
    },
    {
      "accessory": "WeMo",
      "name": "Bug Zapper",
      "description": "Light switch for the bug zapper",
      "wemo_name": "bug zapper"
    }
  ]
}

and finally run Homebridge

And presto, you.... can't do much of anything.

This is because the other half of HomeKit is in your i-device. To setup your home, you need an app to set all the configuration, and thats not something which Apple ships, yet. But there are a few other ones on the market:

The best option, which isn't available to everyone, is the HomeKit Catalog Sample from the Developer Portal. You just need to download it, possibly change the bundle id, then build and run it on your device. The setup, while a bit visually bland, covers pretty much everything that HomeKit can do, including accessories (devices), rooms, zones, users, scenes and other HomeKit stuff.

Once this is setup, you can then go ahead and ask Siri to turn on the lights. This works from any Siri device on your iCloud account, and you can also add other people in using their iCloud address.

HomeKit isn't limited to just Siri for control tho - the HomeKit API's allow you to enumerate the local devices and turn them on and off as needed - so there is no reason why I couldn't write an app with an on/off button, rather than trying to navigate Siri's interpretation of "deck" and "zapper". It also works with non-binary devices like thermostats, dimmers etc.

It'll be great if/when they enable this on the AppleTV, too. The remote is already Siri enabled if you have a US iTunes account, and it'd be nice to do this from the couch.

Turn off the lights, Siri.


  1. "They are working with Apple" according to their Facebook page. As they have been for ages. Don't hold your breath. ↩︎