Tutorial Configure the HA-Bridge with Amazon Alexa under Raspberry Pi

Information:

Let's assume that you have a Raspberry Pi (2/3/0) with the OS installed on it and connected to your network.

Please note, the configuration we are giving you is for a “virgin” Raspberry Pi, that is to say without Jeedom installed on it. At the moment we have not found a way to install Jeedom and Ha-Bridge on the same hardware without putting our Jeedom installations in bulk ...

Installation:

 

1. Create an HA-Bridge folder:

mkdir ha-bridge

2. Enter the folder:

CD Ha-Bridge

3. Download the latest version from github (as of today 5.2.1).

Go check:

wget https://github.com/bwssytems/ha-bridge/releases/download/v5.2.1/ha-bridge-5.2.1.jar

4. You can now launch and play with the HA bridge by launching the command:

Sudo Java -Jar Ha-Bridge-5.2.1.jar

Then access the address of your Raspberry Pi using an Internet browser:

5. The latest versions of Linux use a system to encapsulate the services that start at the same time as the Raspberry (or the PC) which basically means that if you do not add the HA-Bridge to the “capsule” at the next reboot of your Raspberry Pi, HA-Bridge will not start at the same time ...

Here is the procedure quickly translated into French (the source is from HA-BRIDGE's GitHub).

First, create the HA-Bridge file in the system:

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

Copy then paste the following text into the page that opens:

[Unit] Description = HA Bridge Wants = network.target After = network.target [Service] Type = simple WorkingDirectory = / home / pi / ha-bridge ExecStart = / usr / bin / java -jar -Dconfig.file = / home /pi/ha-bridge/data/habridge.config /home/pi/ha-bridge/ha-bridge-5.2.1.jar [Install] WantedBy = multi-user.target

Save the file with CTL-X then O to confirm and finally the Enter key.

Reload the "system" file so that it takes into account our modification

sudo systemctl daemon-reload

To start HA-Bridge:

sudo systemctl start ha-bridge.service

To add it to the Raspberry startup (which is our goal):

sudo systemctl enable ha-bridge.service

 

If you want to see the original version, go to Github.

To check that everything went well, reboot your Raspberry Pi.

sudo reboot

After a few minutes, you should be able to access the web page again with the IP address of your Raspberry.

The configuration

Well, it's nice to have spent 3 hours configuring the Raspberry Pi, but that doesn't make our lights work this story…

We are therefore going to resume the configuration of one of our switches that we installed previously (see the tutorial on hardware installation).

The HA-Bridge finalization of the settings:

Go to the “Bridge Control” tab.

Check that “UPNP IP Address” and “WEB Server IP Address” are filled in with the IP of the Raspberry Pi (only change this):

Adding a new device:

Jeedom offers us a fantastic function: the automatic generation of URLs for our peripherals, this will prevent you from "sniffing" (not the glue, eh?) The frames to retrieve the commands and add the Xiaomi switch from earlier .

Then select your switch and go to the tab " Orders ". Here, you will click on the small cogwheel, then on the line On to access more information.

 

 

You will find three very useful pieces of information there: ID, Name, URL.

 

ID: This is the unique identifier of your order, we will come back to this a little later.

Last name : Allows you to be sure that you are on the correct order (Here the On).

Url: This is the web address that will allow the HA-Bridge to launch the command.

Right click on the link URL -> and select Copy link (paste it in a .txt document with a description next to the kitchen switch genre On) and do the same with the link on the off.

And there, look, miracle! At the end of your URL, you will find our ID. This will serve you well for the next devices to be added.

Now go back to the HA-Bridge interface to add the hardware. To do this, on the web page we will click on Add / Edit.

We only list here what will be useful to us, if it is not listed, do not modify it. 

NAME: The name under which your device will appear in the app Alexa, and therefore the name by which you will call it with Alexa, will be the name you will put here. So avoid the crooked stuff, otherwise you'll have a hard time! Alexa love simplicity. The Alexians too.

DESCRIPTION: To remind you what this corresponds to (when you start to have a lot of peripherals, it is important).

COMMENTS: Kind of like description, but you can put more characters.

DEVICE TYPE: Here, choose "Custom", that's good.

ON ITEMS: /! \ Be careful this is what will determine if it works or not /! \
This will correspond to the ignition (ON) we will fill the line as follows

  1. Type: HTTP DEVICE
  2. Target Item: We paste the URL copied previously for the ON
  3. http Verb: Choose GET
  4. Content Type: application / json

Do not forget to save your modifications by first clicking on Add.

Do the same for Off Items.

Save the set by clicking on "Add Bridge Device" at the top of the page on:

Now you will have your material appearing on the page Bridge Devices:

 

Well, that's not all, but we will have to link the whole (HA-Bridge and Alexa) because there, well, not too much interest… No?

So click on the Echo button, it's a page https:// on the site Amazon which opens, it is used to link the HA-Bridge to your account Amazon (otherwise Alexa don't know where to look). Fill in the information.

Then go to Smart Home (so here, the interface is in English, which is not the case for everyone, so if your interface is in French, it will be Connected home) and then click on Devices.

 

Now two possibilities: either the material is already detected (it is the case here) or you will have to "launch the detection" to find your material (we are sometimes obliged to scan 2/3 times).

We will now check on the application Alexa to make sure that the added device appears.

And voila, now just say « Alexa turn on xxxxx " ou « Alexa turn off xxxxx ".

What is great is that you can incorporate all your peripherals working with an ON / OFF so for example: Lights, Connected sockets…

Have fun !!! 

Fascinated by Alexa since the day I received it in beta test, I gradually became passionate about the subject, before deciding to go further by creating a site with Jean-Christophe. An activity that allows me to quench my thirst for new technologies and share my discoveries about the nicest of communities: Les Alexiens.