Controlling Homematic with Amazon Echo (Dot / Alexa)

Unfortunately, there is no Homematic Skill for Amazon Alexa Voice Service (Amazon Echo). Nevertheless, the [amazon_textlink asin='B00BZ6XLJ0′ text='Homematic' template='ProductLink' store='rpininja-21′ marketplace='DE' link_id='5c019a96-ed0f-11e6-88c1-6f4f9540b732′] can be controlled very easily with the Echo, or, the Echo Dot. You can work through these instructions in about 20 minutes. Since we are simulating Hue lamps to the Echo (Alexa can already address these without a Skill), we can unfortunately only switch and dim lights. Other functions such as shutters would also be conceivable, but they have to be controlled with the voice command "switch on light", "switch off light", "dim light" and therefore does not yet offer a perfect solution for this. However, if you only want to switch lights, this is a very well-functioning solution that I would not want to do without.

Initial situation: I have a Homematic (not Homematic IP) with a CCU1 and light actuators connected to it. We also need a [amazon_textlink asin='B01CEFWQFA' text='Raspberry Pi' template='ProductLink' store='rpininja-21′ marketplace='DE' link_id='7d861404-ed0f-11e6-9605-d1552f921464′]. I already have this in use for other things and can easily expand it for this. In addition, an Amazon Echo or Amazon Echo Dot is of course necessary.

The procedure in brief:

  1. On the Raspberry we install the habridge, an open source Java software which simulates Hue lamps.
  2. These simulated Hue lamps are recognised by Alexa
  3. habridge ensures that a freely selected action is carried out when the simulated lamps are switched, in our case we let the XML interface of the CCU be addressed.
  4. Ready 🙂

Let's start by installing the habridge on the Raspberry Pi:

habridge is a Java software, so we need to make sure that Java is installed on our Pi. This can be done with

sudo apt-get update && sudo apt-get install oracle-java8-jdk

Now we create a new subfolder in our home directory and download it

cd /home/pi/
mkdir habridge
cd habridge
wget https://github.com/bwssytems/ha-bridge/releases/download/v4.1.2/ha-bridge-4.1.2.jar

Next, we create a start file for habridge. In this file we also specify the port on which the web interface should be accessible. I had to change this port because the default port 8080 was already used on my Raspberry Pi:

vi starthabridge.sh

And enter:

cd /home/pi/habridge
rm /home/pi/habridge/habridge-log.txt
nohup java -jar -Dserver.port=8080 /home/pi/habridge/ha-bridge-4.1.2.jar > /home/pi/habridge/habridge-log.txt 2>&1 & chmod 777 /home/pi/habridge/habridge-log.txt

Then we make the start script executable

chmod u+x starthabridge.sh

And start habridge

./starthabridge.sh 

Now we check the log file for errors

tail -f habridge-log.txt

If no errors have occurred, habridge is now installed and is accessible via the port configured above in the web browser.

We now call up the web interface. On the start page we see all the devices that Alexa would recognise as Hue lamps. Of course, none of them have been created yet, but we can change this by clicking on "add/edit".

We only need a few fields for the installation:

  • Name (Alexa will recognise the device under this name, so the name "Living room light" leads to the following voice command "Alexa, switch on living room light")
  • Device Type "Custom
  • Map Type "HTTP Device
  • On Items -> Target Item
    • http://[CCU_IP]/config/xmlapi/statechange.cgi?ise_id=[ise_id]&new_value=1
  • Off Items -> Target Item
    • http://[CCU_IP]/config/xmlapi/statechange.cgi?ise_id=[ise_id]&new_value=0
habridge settings

Note: The XML API addon of the CCU is required for this, which can be found here. The ise_id can be found by calling up the following URL in the browser and then searching for the corresponding device there

http://[CCU_IP]/config/xmlapi/devicelist.cgi

Now we save the configuration. This device has now been set up. We do the same for all other devices / lights that we want to switch.

Finally, we pair the whole thing with Alexa:

We go to the Alexa app, then to Smart Home and scroll all the way down. There we let Alexa search for new devices. This takes a short time and then the setup is complete. The lights can now be switched.

7 comments

    • Hello, I just had a look at the new version. The interface has been neatly revised - I have adapted the article 🙂

  1. Thanks, it works for me now, you're a hero. Do you happen to know how to configure/use the dim item by language? The call of the dimmable lamp is "http://ip/config/xmlapi/statechange.cgi?ise_id=243xy&new_value=0.5" for 50%.

    • Ich habe keine dimmbare Lampe, aber da wir Alexa vorspielen eine Hue Lampe zu sein, müsste sich das ganze so einrichten lassen. Laut habridge Dokumentation wird beim Dimmen der an Alexa genannte Dimmwert im Feld ${intensity.percent} mitgegeben. d.h. dieses Feld musst du in deine URL einbauen. Da du aber nicht 50%, sondern 0.5 brauchst, musst du tatsächlich folgendes einbauen: ${intensity.math(X/100)}
      Deine DimmUrl würde also aussehen: http://ip/config/xmlapi/statechange.cgi?ise_id=243xy&new_value=${intensity.math(X/100)}

      Alexa should listen to the following commands:
      - Alexa, set the brightness in the dining room to 60%.
      - Alexa, dim the light in the living room

      As I said, unfortunately I can't test it, but that's what the docs say.

  2. Evening, unless ... the CCU2 keeps going down the drain ... with IoBroker ....:(
    which is the case with me ....

    Thank you Matthias

1 Trackback / Pingback

  1. Controlling Homematic via Alexa using ioBroker - raspberry-pi.ninja

Leave a comment

E-mail address will not be published.


*