This article is about using Homematic and Homematic IP on a Raspberry Pi running with Raspbian Stretch and integrate it into OpenHab 2. For better reading I will just say Homematic in the article but this is valid for both: Homematic and Homematic IP. For the connection to Homematic the radio module HM-MOD-RPI-PCB is used and piVCCU is used to host the “server” of Homematic. OpenHab and piVCCU are running on the same Raspberry Pi. As every time: Everything will run completely offline in the final setup.
I will add several Smoke Detectors based on Homematic IP in this article. You can use other devices and just skip the part that is about that integration. This smoke detectors are the test winner of the biggest and most important testing institute “Stiftung Warentest” in Germany for connected Smoke Detectors. There are also many other smoke detectors for almost the same price, but they are not “smart” (i.e. Hekatron), not “smart” enough (closed ecosystem i.e. Innogy Smoke Detectors) for the same price, do not fulfill the German Smoke Detector law (DIN 14676/EN 14604) or much to expensive (Bosch TwinGuard, Nest Smoke Detectors, …). Additionally the Homematic IP dectectors are “smart” and able to alarm other smoke detectors even if the base (our Raspberry) is not reachable (i.e. power outage).
The HM-MOD-RPI-PCB is a kit. It is NOT ready-to-use! You have to solder two banks of pins to the board before you can use it! In any case of questions, feel free to write me a message.
First we need to solder the two banks of the HM-MOD-RPI-PCB. In the box that contains the HM-MOD-RPI-PCB is a detailed instruction how to do it. Additionally there is a video at the product page of ELV Elektronik where you can see what you need to do: https://www.elv.de/homematic-funkmodul-fuer-raspberry-pi-bausatz.html
When you are done, you can shotdown and unplug the Raspberry Pi and attach the HM-MOD-RPI-PCB to the GPIO pins 1-12 on the Raspberry. That finally looks like this:
Installation of CCU3 based on piVCCU
Credits to most of this part are going to the piVCCU team.
Most parts are copied from https://github.com/alexreinert/piVCCU/blob/master/docs/setup/raspberrypi.md
Before we start, create a full backup of your SD card
Skip this step if you are using wired Ethernet connection. To use Wireless LAN, please click => here <=.
Reboot the system
Install CCU3 container
sudo apt install pivccu3
When the installation is almost done, you are asked about the radio module. Select “HM-MOD-RPI-PCB or RPI-RF-MOD (only on supported platforms)” and press enter.
Start using your new virtualized CCU, you can get the IP of the container using
The piVCCU installs a virtual machine on the Raspberry. That machine has it’s own IP address. You see the IP in the output of the command above.
Configure the Homematic CCU
After the CCU is installed, we can try to access the CCU. Open http://<Ip of your piVCCU> in your browser. i.e. http://192.168.0.162.>
You will be asked about the password in the first step. Enter a password of your choice and click “next”.
In the next step select custom setting.
Now configure the following settings to allow OpenHab to access the Homematic API:
Set “Homematic XML-RPC API” to “Restricted access”
Set “Remote Homematic script API” to “Restricted access”
Set “Port opening” to “2000;2001;2010;8701;9292;”
Add the IP address of the OpenHab Raspberry to the list “IP addresses for restricted access”. Do not forget the semi-colon (;) in the line above!
Now read the security warnings and check “I have read the above warning” and click “Next”.
Now the setup of the CCU is completed. We are ready to pair devices.
Add Homematic IP device to CCU
In this section I will describe the connection for the smoke detector. Other Homematic devices may be connected slightly different.
To add the smoke detector follow these steps:
Read the manual of the device how to set the device in pairing mode. Do not start pairing at this point.
Click on “Teach-In devices” at the to right of the Homematic CCU Website.
In the next window we want to connect the Homematic IP device without a internet connection. Because of this we have to enter the key and the sgtin into the two text fields. At my smoke detector there was a sticker with a QR-code and this two strings in the first page of the manual. After you entered this strings, click on “Teach-in HmIP device (local)”.
Immediatly after click on the button, start the pairing of your device. My smoke detectors need to be mounted to the frame to be turned on and start pairing. After some seconds in the Inbox at the lower left will be “Inbox (1)”. That means, that the smoke detector was paired with the CCU that is running on our Raspberry Pi.
When you click on the “Inbox” button, you will see the device in the inbox.
Click on the “Done”-Button in the last column of the inbox row.
To check if everything was successful, click on the “Status and control”-button at the top left and select “Devices”
You will see a list of devices. The first two devices are the CCU. The third one is the smoke detector.
Now the Homematic CCU knows your devices and we can teach OpenHab to use the CCU we just installed.
Now let’s integrate the CCU and all it’s devices to OpenHab.
Start the PaperUI of OpenHab.
Go to “Add-ons” (1) and select the “Bindings”-Tab (2). Enter “homematic” in the search box (3) and in the result list click on install (4).
After the installation is done go into the inbox (1) and click the checkbox in front of the CCU3 item. Choose a name for your CCU (i.e. “Homematic CCU3”).
After you finished, the CCU is now part of your configuration as a bridge and discovers all of your connected devices automatically. In my environment it looks like this:
Add all of the Items by click on the blue check-bubble in front of the device and enter the name of the device. Finally click “Add as Thing”.
After that you will find the devices as a “Thing” at “Configuration” => “Things”.
After that you can click on the gray bubble in front of the thing. Here you have to configure the channels. For my smoke detectors there is a “Show More”-Text at the right that hides most of the features the smoke detectors have. I believe that the default view should show the “most used” channels.
To configure a channel, click on the blue bubble in front of the channel name. A popup will be shown. In the upper box leave “Default” and in the lower box select “Create new Item”.
Another popup will appear. Just confirm the settings by click on “Link” at the lower right. Both popups will disappear but the inner part of the bubble in front of the channel name will now be filled.
If you switch to the “Control”-Element in the navigation bar, you will see the configured thing with the configured channel.
We can now send us a notification when a smoke detector starts to alarm. i.e. by
Product links marked with * are affiliate links. That means I get some percent of the money you will spend when you are using this links. I’m not trying to influence you. In most cases there are also other sellers for the products where I don’t get money for. I am not trying to influence you to spend more money than you need. If you are using this links, you don’t have to pay anything extra. It is the same price as if you enter the shop on your own.
You accept the usage of cookies when using this website. More...