Advertisement
Hinweis: Diese Seite enthält Werbelinks

Smart Home – openHAB 2 KNX Alexa Speech Recognition

In this post I will tell you how to set up a KNX Alexa speech recognition with openHAB 2. You do not have to pay a lot of money like for other KNX products. I will tell you what you need and how to set it up step by step.

You no KNX but a different smart home technology? That is no problem with the Hue Emulation Service you may control or your Z-Wave, Homematic and Zigbee Stuff.

openHAB 2 – KNX Alexa Speech Recognition – Prerequisite

KNX Alexa Speech Recognition – Prerequisite – openHAB 2 Server Set Up

First of all you should follow my post about how to set up a openHAB 2 server. You will find an instruction how to get it running on Windows in the same post. If you pick preferred hardware like a Raspberry Pi you should directly read how to Set Up openHAB 2 on a Raspberry Pi.

KNX Alexa Speech Recognition – Prerequisite – KNX IP Gateway

Of course you will need a KNX installation in your home. If you are lucky and have KNX, you should check if you have a KNX IP Interface or Router installed. If so, you only need to get your IP configuration of the KNX device. I will tell you later in the post how to do that.

You should choose a rooter, if you wan to access your KNX bus with more than one Server. If only openHAB 2 connects to your KNX bus, a IP Interface is all you need.

I have made good  experience with the following KNX Router.

If you pick a IP Interface. You should go with:

If you are not familiar with ETS and programming KNX components, you will need an electrician to install the gateway in your home.

KNX Alexa Speech Recognition – Prerequisite – Amazon Echo

The next gadget you will need is an Amazon Echo Dot or an Amazon Echo. You not need the big version, if you do not want to play music a lot. Even if you pick the dot you may connect via Bluetooth or audio jack to your HiFi Equipment.


Connect your Amazon Echo to your network and follow the Set-Up Instruction of the Alexa App.

openHAB 2 – KNX Alexa Speech Recognition – Configuration

After setting up the needed hardware and the basic installation of openHAB 2 you are ready to go with your configuration.

KNX Alexa Speech Recognition – Configuration – KNX IP Gateway

As mentioned above you will need the correct parameter in your KNX IP Gateway or get the data from there if you already own a KNX IP Gateway.

If you own a gateway, ask you electrician to send you the configuration of your gateway. Tell him you need the IP Address he configured in your IP Gateway. If you do not have a gateway you can tell your electrician what kind of configuration he should do.

The images down below might differ a bit, because I have an old ABB IPR/S2.1 Router. But it is out of stock most of the time. So pick your device for example from the recommendations above.

First of all he should set the IP Setting so you will have a fixed IP. It does not make sense to use DHCP, because you always want the same address. Go to your Device and click IP Settings (1). Then choose fixed (2)

Smart-Home-openHAB-2-KNX-Alexa-Speech-Recognition-IP-Gateway-Settings

No you should go to IP address (1). Choose a unique good to remember  IP address for your KNX IP Device (2) e.g. 192.168.5.111 . Put in a Subnet Mask. That should typically be 255.255.255.0 (3). The last Address (Standard Gateway) will be filled with your Router IP (3) e.g. 192.168.5.1.Smart-Home-openHAB-2-KNX-Alexa-Speech-Recognition-IP-Gateway

KNX Alexa Speech Recognition – Configuration – KNX Binding and Configuration

Now you will have to connect your KNX IP Gateway to openHAB 2. First of all go to the PaperUI into the Add Ons. Replace <openHAB_IP> with the IP of your openHAB 2 device.

http://<openHAB_IP>:8080/paperui/index.html#/extensions

Scroll down and you will find the KNX Binding (ignore the rectangle around Hue Binding). Click Install on the right side.

openHAB2-Binding-installi

After the installation was successful, the item should show a blue circle in front of the binding and the INSTALL will change to UNINSTALL.

Smart-Home-openHAB-2-KNX-Alexa-Speech-Recognition-KNX-Binding

If you use Windows, simply go to your configuration folder within the Smart Home Designer and open the services folder. Double Click on knx.cfg to open the file.

Smart-Home-openHAB-2-KNX-Alexa-Speech-Recognition-KNX-Config

Now you have to change some lines to connect openHAB 2 to your KNX Bus. Some guys mentioned, that it should work with simply changing the connection type to type=ROUTER.

# KNX IP connection type. Could be either TUNNEL or ROUTER (optional, defaults to TUNNEL)
# Note: If you cannot get the ROUTER mode working (even if it claims it is connected), 
# use TUNNEL mode instead with setting both the ip of the KNX gateway and the localIp.
type=ROUTER

But in my set up it did not work. I had to put in the IP address that was configured in the KNX IP Gateway. So you will change the following. Replace <KNX_Gateway_IP> with the KNX IP Gateway address from above:

# KNX gateway IP address 
# (optional, if serialPort or connection type 'ROUTER' is specified)
knx:ip=<KNX_Gateway_IP>

If you are using openHABian you will have to change an additional line . The Local IP (<openHAB_IP>) will be replaced by your openHAB 2 device IP. So this is only optional, if you do not use openHABian leave the line as is.

# Local endpoint to specify the multicast interface, no port is used (optional)
knx:localIp=<openHAB_IP>

KNX Alexa Speech Recognition – Configuration – Hue Emulation Service

Call your Addons again (1). Goto Misc (2) and Install (3) the Hue Emulation Service.

Smart-Home-openHAB-2-KNX-Alexa-Speech-Recognition-Hue-Emulation-Install

After you have installed the Hue Emulation Service in openHAB 2 go to.

http://<openHAB_IP>:8080/ui/index.html#/configuration/services

Click the tab IO. You should see a box wit Hue Emulation. Click Configure and now you have to choose “Pairing Enabled”. Do not forget to SAVE.

Smart-Home-openHAB-2-KNX-Alexa-Speech-Recognition-Hue-Emulation-Enable

KNX Alexa Speech Recognition – Configuration – Sitemap and Items

Now you have to configure your items to control your KNX installation by speech. We will pick two simple items. A Switch (on/off) and a Dimmer (Percentage Value, On/Off).

Open your Smart Home Designer and add the following lines in your .items file:

Configuration – Sitemap and Items – Groups

Group gKitchen
Group gEGLight

Configuration – Sitemap and Items – Items

Switch eg_ki_l_all  "Kitchenlight"      <light> (gKitchen, gEGLight) [ "Lighting" ] { knx="1/1/11" }
Dimmer eg_ki_l_ceil "Kitchen Ceiling" 	<light> (gKitchen, gEGLight) [ "Lighting" ] { knx="1/1/1,1/1/3,1/1/2" }

The simple Tag [ “Lighting” ] will now lead to recognition in the Hue Emulation Service. Save your .items file.

KNX Alexa Speech Recognition – Configuration – Alexa, discover devices

Now tell say “Alexa, discover devices”. It should identify the two new items. You could also use the Alexa app. Goto Smart Home and click Discover Devices.

Here is one Example, how it should look with your items.

Smart-Home-openHAB-2-KNX-Alexa-Speech-Recognition-Alexa-App-Group-Devices

If nothing is discovered, double check your Settings in the Hue Emulation Service by calling this address in your browser.

http://<openHAB_IP>:8080/ui/index.html#/configuration/services

No you are ready to go and the following examples should work.

  • “Alexa, turn on/off Kitchenlight”
  • “Alexa, set Kitchen Ceiling to 50%”
  • “Alexa, turn off Kitchen Ceiling”

Video is in German, but it will give you an impression.

YouTube

By loading the video, you agree to YouTube's privacy policy.
Learn more

Load video

PGlmcmFtZSBsb2FkaW5nPSJsYXp5IiB3aWR0aD0iNzAzIiBoZWlnaHQ9IjM5NSIgc3JjPSJodHRwczovL3d3dy55b3V0dWJlLW5vY29va2llLmNvbS9lbWJlZC9Tal9qQ00tZ3FVZyIgZnJhbWVib3JkZXI9IjAiIGFsbG93ZnVsbHNjcmVlbj48L2lmcmFtZT4=

This solutions is a lot cheaper than other devices for KNX and you are much more flexible. If you want to get Updates, subscribe to the quarterly Newsletter. If you saved money, spend me a coffee. Thnx!

Tags:

Smarthome Training and Tutorials
Logo