As I speculated, HA Bridge does a very good acting as a proxy between Amazon Alexa and IoT devices defined in Domoticz. Installation was straightforward, aside from a little bit of fumbling adding Java which is a prerequisite. The details are provided below.
Table of contents
- Installing Java
- Installing HA Bridge
- Importing Domoticz Devices
- Using HA Bridge Devices with Alexa
Begin with the usual update and upgrade before attempting to install the required Java SDK.
There is an "untrusted" PPA (Personal Package Archive) belonging to the "WebUd8" team which contains the Oracle Java 8 runtime environment JRE. The instructions on that page do not include details about importing the GPG signing keys, while the page entitled Install Oracle Java 8 (both JDK8 and JRE8) in Debian contains the missing information.
This is not an Open source package, and it is necessary to accept the licence agreement with two clicks.
After the last installation message is displayed, test for the presence of the run time interpreter and the compiler.
javac, the compiler, is installed, the Java Development Kit (JDK) was installed. The JDK is a
superset of the JRE capable of creating and compiling Java programs.
As can be seen, the version of Java that was installed was not open source which is why the Oracle licence had to be accepted. There is an open source version. I did not test it on Armbian, but I did install it on a Raspberry Pi 3 running Raspbian Stretch.
That did not go very smoothly. There was a problem with getting the
source from the repository, so I retried a few minutes later. The whole
package was downloaded but there were problems. I had to repeat yet again the
install command and found that
dpkg was having problems setting
ca-certificates. Others had bumped up against this problem
and some clever people found the solution and posted it on the Raspberry Pi
Forum topic missing jvm server. Either of the last two replies (as of the
time of writing this) by gasi12 or by amal.barman give a working solution. I applied the last one.
As can be seen, the last installation did yield some complaints but the run time environment appear to be in place. After that I added HA Bridge as described below and it did work with OpenJDK.
I did not test this in Armbian. It does look as if OpenJDK could be installed along with Oracle JDK8 following How To Install Java with Apt on Debian 9 by Brian Hogan. I decided to leave well enough alone. Perhaps at a later date, I will try the OpenJDK on the Orange Pi Zero.
Installing HA Bridge is pretty straightforward following the instructions in Manual installation of ha-bridge and setup of systemd service. Just make sure to check the name of the latest release on the GitHub site. Currently this is version 5.2.2 Release candidate #3 available since November 14, 2018.
First download the latest release, which is a
.jar file, and
then create a
Do not forget to adjust the
ExecStart lines so that the current user name is used.
HA Bridge has a Web-based interface at the
default HTTP port: 80. Hence the URL to reach
the bridge is
http://192.168.1.32 assuming that is the DHCP assigned
address of the Orange Pi Zero or, in my case, because I set a static address
Of course when first started, HA Bridge does not have links to any devices as can be seen on the initial login page screen.
However, it is very easy to import all of the devices already set up in Domoticz. Click on the Bridge Control button/tab.
And then scroll down to
Domoticz Names and IP Addresses.
Only three fields had to be filled in:
can be anything,
Port which must be
the address of the Domoticz server. The latter's
website is protected with a username and password but clients on the
local network do not have to supply these as defined in its
Once these three values are set, two buttons must be pressed. First the HA Bridge pops up a "wait until initialization is completed" message. I found it necessary to refresh the page after that message disappeared and then a new button/tab appeared: Domoticz Devices. Clicking on it, reveals list containing all devices, groups and scenes defined in Domoticzs.button to the right of the fields and then the button at the top of the page. As soon as that button is pressed,
I checked the devices and groups that I wanted to control with voice commands to Alexa on the Echo Dot. There were 14 of them. Then I clicked on the button at the bottom of the page. I waited a little while, refreshed the page and found the added devices in the tab.
Using the HA Bridge
treated them as switches but Domoticz uses slightly
different JSON URLs for switches and groups/scenes. Click on the
of each scene or group and modify the Target Item
of the On Items and Off Items.
The change is minimal,
¶m=switchlight should be
¶m=switchscene as shown below.
If you wish, it is possible to change the device type to
scene as appropriate. This is cosmetic and does not change
Do not forget to click thebutton at the top of the page after both edits to complete the operation. Test that these scenes or groups now work with the , buttons.
And that is basically it, HA Bridge is now functional. You can click on the My Echo button at the top of the page to let Alexa discover all the devices that HA Bridge now makes available.
Because of my previous experimentation Amazon Alexa and HA Bridge, I had to undo some things. Unfortunately, I did not record exactly what I did, which in any case would not be very useful. Quickly, here is how I went about getting Alexa back to its initial status.
- I stopped the Philips Hue and Wemo emulation on two Sonoff with
Tasmota firmware. This is done with the Web
interface of each switch and clicking on the , buttons and then selecting
- In the Amazon Alexa application, I clicked on Smart Home and then removed all the groups, scenes and devices that I had previously created when first testing the application. The only exceptions were the Echo Dot and the Amazon Smart Plug.
I used the Amazon Alexa web interface to initiate discovery. Apparently, this can
be done with a verbal command but the Echo Dot is
down two flights of stairs, and I am much too old to run up and down stairs
and was too much in a hurry to leisurely do the round trip. I clicked on
Smart Home then
Devices and then on the button. I am
"guessing" about these names translating them from the French terms.
I pressed the discover button twice, perhaps I was too impatient. And I may have refreshed the page but before long all the devices known to HA Bridge were found by Alexa.
At this point, it was possible to turn on or off any lamp or device with verbal commands.
I am glad to have found a good use for the Orange Pi Zero which is now
enclosed in the very small black plastic cube that I purchased with it. It
sits near the television set, not too far from the Echo
Dot, running two programs: HA Bridge as
outlined above and an IR remote control bridge I wrote in Python called
ir-rem.py. Now I can turn on or off any IoT device in the house
with verbal commands or with an IR remote. So far it all works very well.
Time will tell how stable this solution is. Among things that could go wrong,
I include a possible decision by Amazon, imitating
Google, to remove local handling of Philips devices. If that happens, the IR remote will still
Installation of HA Bridge and integration with Alexa was a pleasure. It took much less time to do that than to write it up. It seems pretty clear that the procedure would be quite similar if using other supported open source home automation programs such as OpenHab and Home Assistant or commercial products as well. Thank you very much BWS Systems.
I wish the third generation Echo Dot and the French Canadian version of Alexa had been available sooner. I have couple of Google Home Mini still in shrink wrapped-boxes that I would willingly exchange for Echo Dots. Anyone interested?