Absolutely simple way to add Alexa support to more than 20 smart home systems – with HA bridge

Published by Oliver on

I have already written about how you can add Alexa support for OpenHab. If for some reason this is not possible (I had problems with this setup in a Docker container) or you are using another smart home system: here is another way I found to add Alexa support. And this one supports a whole bunch of smart home systems!

When one solution is not working…

I recently migrated the family server to a new platform, based on ZFS and Docker(-compose). This includes OpenHab and all related programs which are now happily running inside Docker containers. Unfortunately it turns out that the Hue emulation binding needs Upnp and some other advanced network features.

These advanced network features only work with Docker if you run the container in host mode, which directly uses the hosts network interface so there is no port rerouting possible. Since about a year ago Alexa requires to have the Hue bridge running on port 80. On the server port 80 was already in use by the reverse proxy traefik though so this solution was not possible for me.

Yet Alexa support is pretty important for me so I started looking for other ways to enable the voice assistant again.

There are other more complicated possible solutions out there, like macvlans, but those are complicated to set up. Instead I decided to use an old Raspberry Pi I still had and install a software I had been using some years ago: HA bridge.

One bridge to rule them all

Ha bridge works similar to the hue emulation binding in OpenHab: it creates a virtual Hue bridge that Echos/Alexa can discover to allow them to control any devices in your smart home. The great thing about it is that it can be run on a separate device with a separate IP adres (therefore port 80 is free) and itself connects to a very long list of devices & smart home software: Logitech Harmony Hub, Vera, Vera Lite or Vera Edge, Nest, Somfy Tahoma, Home Assistant, Domoticz, MQTT, HAL, Fibaro, HomeWizard, LIFX, OpenHAB, FHEM, Broadlink, Mozilla IOT, HomeGenie and even real Hue bridges that can be proxied.

It also comes with a web interface for easy administration and is, in my experience, very reliable. Even an older model of the Raspberry Pi B+ is easily able to run it.

Resources on this older Raspberry Pi are more than enough to run HA bridge

Installing HA bridge

The installation of HA bridge is pretty easy. Start by setting up your Raspberry Pi any way you like and connect to it via SSH. Make sure you have Java installed. To install HA bridge you need to first create a new directory and then download the latest release.

mkdir ha-bridge
cd ha-bridge
 wget https://github.com/bwssytems/ha-bridge/releases/download/v5.3.0/ha-bridge-5.3.0.jar // replace with latest release version
 java -jar habridge-5.3.0.jar // you could start the program like this now but there is a better solution

Now we can add HA bridge as a service to run it automatically on startup. This will be done via systemd like this. First create a new service file:

cd /etc/systemd/system
sudo nano ha-bridge.service

And then copy this into your new service file. Make sure to update the name of the jar file if you are using a different version. I had to also change the home folder as I was using a different user than pi.

Description=HA Bridge


ExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/ha-bridge/data/habridge.config /home/pi/ha-bridge/ha-bridge-5.3.0.jar


Now we are ready to start the service and enable autostart with these commands.

sudo systemctl daemon-reload
sudo systemctl start ha-bridge.service // start the program
sudo systemctl enable ha-bridge.service // enable autostart

Thats it, your HA bridge should be running now. Just open a browser and go to port 80 on the IP-address of the Raspberry Pi and you should see the web interface. The devices list will still be empty though.

Add alexa support via the webinterface of HA bridge
Webinterface of HA bridge

How to connect OpenHab to HA bridge

Lets make our OpenHab installation and HA bridge into friends! Fortunately that is very simple. Go to the web interface of HA bridge and find the “Bridge Control” tab on the top of the page. This will bring you to a configuration page.

Now go and scroll down. You will see a list with lots of entries that allow you to connect all kinds of services to HA bridge. HomeAssistant, Domoticz, Nest, … whatever you need. In our case find the OpenHab row. Here we can simply add a name for this OpenHab instance (which is just used in HA bridge to identify the instance) and the IP address. Also give a port and if you secured your instance a username/password combo as well as the “Use SSL” checkbox. In my case I do not, so I left those fields open. Scroll back to the top and click the green “Save” button.

OpenHab configuration in HA bridge

Now the instance will restart which might take a couple of seconds. Afterwards you should see a new tab called “OpenHAB devices”. Here you should now see a list of all devices in OpenHab. If you don’t then go and check you OpenHAB bridge settings from vefore or check the log tab.

Alexa support for everything

To make HA bridge simulate any devices you need to add them from the OpenHAB devices tab. Find the device you want to control and click the green “Build Item” button. The bulk add function did not work properly for me, so better do it one by one.

Add one device to the virtual hue bridge via ha bridge
Device details screen – you can use the defaults

You will be redirected to the details screen for the item you selected. At least in case of OpenHab items the default values have always been working for me, so I suggest to not change those. The only exception being the name. Choose something recognizable here.

If you are having problems (or feel like experimenting) you can change how the virtual Hue lightbulb will behave in case of state changes. You can, for example, send a MQTT message when someone dims the device via Alexa. In any case once you are done just click the “Update bridge device” button on the top. Repeat for all items you want to control via Alexa.

To test if the Alexa support works you can use the different test buttons in the “Bridge Devices” tab to check. Clicking “Test ON” for example should do the same thing as asking Alexa to turn the light on later. If your physical light bulb does not react check in your OpenHab logs or in the device settings.

testing the ha bridge integration
Test actions to check if your device integration is working

Now let’s make Alexa aware of these new devices. Just use the App or ask Alexa to search for new devices. It should find a number of new devices, one for each one you added. Now just ask Alexa to turn the a device on/on/dim… Tada, Alexa support done!

Wrong name?

If you are wondering where the names of these new devices are coming from or how to change them… HA bridge will take the item name from the OpenHab config (e.g. Switch SonoffrfBridgeBtn_Reachable will result in a bridge item called SonoffrfBrdigeBtn_Reachable).

You can change it HA bridge while creating the item (or even later while updating it) by changing the content of the “Name” field. You can also change it directly in the Alexa App although I do not recommend that. If you do the configurations in HA bridge you can at any time remove the items in Alexa and reimport them. This comes in handy if you run into any problems.

The only exception in my case were certain special characters in German (Ä, Ö, Ü) which produced some encoding errors resulting in strange names in Alexa. I had to manually rename those devices in the App.

If you are looking for a new project that uses the Alexa support how about controlling your smart vacuum robot? Or build a smart lighting system with voice assistant support.

Categories: BasicsOpenhab