‹ gerlach.coffee

Bridging Homekit to Alexa

Dec 02, 2017

I recently bought a few Leviton Decora Smart smart home switches. I specifically bought them for their Apple HomeKit integration, which is usually the most choosy protocol. I had assumed that this would also work with Alexa (which I prefer to Siri because it understands me a lot better), but those specific switches work only with Homekit. So I had to find a way of somehow bridging them to Alexa. This is how:

There is a software called Homebridge. It’s a project that pretends to be a HomeKit bridge (a bridge is what bridges appliances to HomeKit; like your Philips Hue bridge does to your lightbulbs). It allows for very simple integration of appliances that don’t have HomeKit integration (like a Nest) to HomeKit, by providing a simple interface to HomeKit and an easy plugin system. More interestingly for my use-case, there is a fork of Homebridge that allows Alexa to discover the devices added through these plugins as well, called homebridge-alexa.

The last big piece of the puzzle is that Apple now allows simple automation through their Home* app. This unfortunately requires an always on, always in-house iPad, or an Apple TV, but we will assume that is okay for people that throw money at wifi-enabled lightswitches.

The big idea is to set up a fake light in home bridge for every real one, then to expose these fake lights to Alexa.

This is how I did this, with the example of my kitchen lights:

  • Install homebridge-alexa

  • Install homebridge-fakebulb - this is a very simple plugin that just pretends to be a lightbulb and doesn’t otherwise do anything

  • Configure homebridge with this config.json:

{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-154",
        "ssdp": 1900
    },
    "description": "",
    "accessories": [{
           "accessory":      "FakeBulb",
           "name":           "Test lamp",
           "bulb_name":      "Lamp1"
       }],
    "platforms": []
}
  • Set up your iPad/Apple TV to act as a hub to enable automations: Hub

  • Set up automations to have the fake light and the real switch to follow each other:

step automation

  • Have Alexa discover your new devices

Now you should be pretty much done. Give it a try and tell Alexa to turn on the kitchen lights, and it should work. Homebridge seems to work fine on a Raspberry Pi, so that is an option, and something that I will do soon. I hope this helped somebody!