Updated 8/9/2018 – I now use Home Assistant for all of these integrations with Alexa instead of ha-bridge. Home Assistant also works with Google Assistant.
Ever wanted to change channels on your cable/satellite receiver with a voice command? how about switching the source or turning the volume up or down on your receiver? Most people with smart homes already know how to integrate Alexa with their lights and use smart plugs to turn devices on and off. This article shows how I use Alexa to control other home devices and will point you in a direction to be able to do the same without writing your own Alexa skills by using ha-bridge.
Before we get started, let’s talk about the requirements for this solution to work. You are going to need a computer that you can run Java on and you can leave on all the time for Alexa to access. The devices to control via ha-bridge/Alexa need to have some type of HTTP control interface that doesn’t require authentication. For example, Most DirecTV receivers have a web interface that allows you to control the receivers by issuing HTTP commands (you can get more details on the commands in this document). You might be amazed at how many of your smart TVs, networked A/V receivers, set-top boxes and other devices have HTTP command interfaces. You might need to Google around a bit to find them.
Now that you understand the basics it is time to delve into the ha-bridge software that will allow for the Alexa control. This home automation bridge software works by emulating the Philips Hue light system to interface with Alexa. Alexa thinks it is making calls to a Philips Hue bridge, but the ha-bridge takes those commands and processes them how you have specified. The software has native capabilities for Vera home automation hubs, Logitech Harmony Hub, Nest, LIFX light bulbs, and more. The native integration simply means you don’t have to go hunting around for specifications for these system’s network control interfaces. The ha-bridge has them built in.
You may be wondering why you would use the ha-bridge instead of direct Alexa integration. All of the systems I listed above have Alexa skills. There are a couple of reasons, and they may or may not be selling points for you:
- The ha-bridge allows you to keep your smart device traffic on your LAN. While I’m sure all these protocols are fairly secure, some of us are more paranoid than others about allowing access to their smart devices over the Internet. Ha-bridge can give you an alternative by processing commands only on your LAN.
- Not every device has an Alexa skill. I have a few devices (such as my older Denon A/V receivers) that don’t have Alexa skills.
Installing ha-bridge is pretty straightforward:
- Install the latest Java JDK for your architecture.
- Download the latest version of ha-bridge from the GitHub repo. As of the writing of this article, the latest ha-bridge can be downloaded from https://github.com/bwssytems/ha-bridge/releases/download/v5.2.1/ha-bridge-5.2.1.jar.
- Then you run the ha-bridge JAR file. In a console/shell go to the directory where you downloaded the ha-bridge JAR file in step 2 and run the command
java -jar ha-bridge-5.2.1.jar
(change this command to use the version of ha-bridge JAR file you downloaded)
More details on installing the ha-bridge on different architectures and different options you can configure when running it can be found on the GitHub page.
Configuration can take some time. You need to spend time making decisions on what you want to control and researching the HTTP commands needed to control the devices. Then you go into the interface, located by default at
<ipaddress> is the IP address of the machine where you ran the command
java -jar ha-bridge. You should see a screen like this:
I have added 51 devices. The “name” field determines how you refer to this device when using Alexa. For instance, I can say “Alexa, turn on Chromecast” or “Alexa, turn on ESPN.” If you click the Edit/Copy button you can get to the configuration for this command.
The page above shows the configuration for the Chromecast command. The important item here is the “On URL.” This is the HTTP command I send to my networked Denon receiver. It changes the input to “DVD” which is the input connected to my Chromecast. This command is sent when I say “Alexa, turn on Chromecast.”
I also can control my DirecTV receiver via ha-bridge:
The HTTP command to change the channel to ESPN (DirecTV channel 206) executes when I say “Alexa, turn on ESPN.”
Configuring Alexa to work with ha-bridge
Put your echo into device discovery mode after you have added your devices to the ha-bridge. You can do this by telling Alexa to discover devices or through the Alexa app.
Ha-bridge is easy to set up but it is not without limitations:
- You are limited to “turn on,” “turn off, ” and “dim” commands. This makes some phrasing awkward. You have to say “Alexa, turn on pause MythTV” instead of “Alexa, pause MythTV.”
- It doesn’t work with Google Home. Google home changed their service to only work with http://meethue.com, the cloud-based interface to Philips Hue bulbs. This is why I now use Home Assistant for my Google Assistant voice integration.
- Names for the devices need to be distinct so the Alexa can differentiate between them. Otherwise, Alexa will have a hard time knowing which command you are trying to execute.
- You may need to have a first generation Echo to perform device discovery. Later generation Echos sometimes have problems recognizing ha-bridge. Once all devices are recognized any Echo can use them.
Those are some pretty big limitations, but I still use it to control MythTV, DirecTV receivers, Vera devices, and my Denon receiver. It is stable and works consistently. As more and more devices integrate directly with Google Home and Alexa it isn’t as needed. However, I like having some of my smart home controls stay on my LAN. Makes me feel more secure.
Do any of you use ha-bridge? What do you think of it? How do you tie in your devices to voice control? I would love to hear about it and discuss it in the comments below!