Home Assistant and HA Bridge
What does it enable me to do?
“Alexa, turn on my living room lights”
My living room lights turn on and Alexa says “Okay”.
“Alexa, turn on my Apple TV”
My Harmony Hub turns on my Samsung TV, Onkyo A/V receiver and Apple TV. The Onkyo changes the HDMI input to the Apple TV. Alexa says “Okay”.
“Alexa, turn on sexy time”
All the lights in the house turn off, except the bedroom lights which turn red. Yeah, this is a thing. All I need now is for some Barry White to stat playing and I have a real creepy scenario complete! Oh and Alexa says “Okay”.
So let’s take a quick look on the pieces needed to begin. I won’t go into detail on everything you can do, just what you need to know to get going.
- A computer of some sort, I use a Raspberry Pi running Raspbian.
- An Amazon Echo
- A working installation of home-assistant on the computer
- A working installation of ha-bridge on the computer
There are many ways to configure this…again, I’m going for simple. You can work out the rest yourself.
How does this work?
Here is the secret sauce that makes the magic happen:
- The Amazon Echo listens to my voice commands
- The Amazon Echo can turn on, off or dim Philips Hue lights
- HA-Bridge can pretend to be a Philips Hue bridge
- HA-Bridge can send instructions to other systems
- HA-Bridge fools the Amazon Echo into thinking that it is controlling lights when in fact it’s controlling whatever we want
The only downside is that we’re restricted to “turn on”, “turn off” and “dim” commands. But, we’re going with simple so it’ll do for now.
Okay, you want a full example. Let’s take a look at getting a simple light to turn on and off.
In home-assistant I have set up my LimitlessLED (also known as Easybulb) lights.
Now when I run home-assistant I can see those in my interface and interact with them by flicking the ‘switch’.
Home-assistant very kindly exposes all of your devices over a REST API with a nice and simple syntax. Note that I have HTTPS enabled and an API password.
Let’s take a look at how to set up HA-Bridge to talk to those lights.
Open up the
Manual Add tab in the HA-Bridge web interface:
For more information on the REST API we will call, check out the HA help documentation
Using the example URL’s above we enter in the following details:
Name: Whatever you want to say to Alexa, e.g. “Office Lights”
Device Type: Custom
Dim URL: Blank
HTTP Verb: POST
Content Type: application/json
Content Body ON:
Content Body OFF:
Alexa will pick up your newly created bridge device as a Philips Hue light and make it available for voice activation. I use lights, scripts, scenes and more. As long as I can ‘turn on’ and ‘turn off’ then I’m voice activating it.
Try as I might, I can’t get Alexa to turn on my fiancé though.