Contents
The route depends on the hub. On a CCU3 (as well as RaspberryMatic and OpenCCU), the free add-on CCU-Jack handles the connection (variant A): presence and detection zones appear as Homematic contacts, plus number of people, temperature, humidity, and the availability of the sensor. The Home Control Unit (HCU) takes presence and zones via its MQTT plugin and needs its own broker for that (variant B). The Homematic IP Access Point does not accept third-party sensors.
Placeholders in the tables:
-
<Hauptthema>stands for whatever is entered on the sensor under Connections → Main topic. -
<ZONE1>…<ZONE4>stand for the names of detection zones 1 to 4, as they appear in the topic: in uppercase (SofabecomesSOFA).
Enter your own values, without the angle brackets. Please observe upper and lower case.
Requirements
- KL MZ multi-zone presence sensor with firmware 1.4.3 or newer, set up on Wi-Fi, detection zones drawn
- Variant A: CCU3, RaspberryMatic, or OpenCCU with a fixed IP address and CCU-Jack 2.13.0 or newer
- Variant B: HCU with the MQTT plugin installed and an MQTT broker on the home network (e.g., Mosquitto)
Setting up the sensor
- Name the detection zones in use under Zones → Zone names, using only letters, digits, and
_, without spaces and umlauts (e.g.,Sofa,Schreibtisch). The name becomes part of the topic. Do not change it afterwards, otherwise nothing arrives at the hub any more. - For variant A, first complete steps 1 to 3 below (CCU-Jack is the broker). Then go to the sensor web interface → Connections:
| Field | Value |
|---|---|
| Connection type | MQTT Broker |
| Server | Variant A: IP address of the CCU3, variant B: IP address of the broker |
| Port | 1883 |
| Main topic | freely selectable, only letters, digits, and _
|
Everything else stays as it is (for variant B, login and password, if your broker requires them). After you click Save, “connected” appears at the bottom of the page after a short while.
Setup
Variant A: CCU3 with CCU-Jack
-
Install CCU-Jack. Download the latest version from github.com/mdzio/ccu-jack/releases; for the CCU3, the file
ccu-jack-ccu3-rm-rp2+3-<Version>.tar.gz(for OpenCCU, see the mapping table) and install it without unpacking it on the CCU3 under “Einstellungen → Systemsteuerung → Zusatzsoftware” (Settings → Control panel → Additional software). -
In the CCU3 firewall, open the ports 1883 and 2121.
-
Open CCU-Jack in your browser at
http://<IP der CCU3>:2121/ui. Under “Konfiguration → CCU-Anbindung” (Configuration → CCU connection), switch on the option “Virtuelle Geräte aktivieren” (Enable virtual devices), save, and restart the CCU3. -
Connect the sensor to CCU-Jack (section above).
-
In CCU-Jack, under “Virtuelle Geräte” (Virtual devices), click “Virtuelles Gerät erstellen” (Create virtual device). The “Gerätesymbol” (Device icon) is only the display; choose any one. With “Kanal hinzufügen” (Add channel) create these channels, in this order:
- “MQTT Fenster-/Türkontakt” (MQTT window/door contact) (presence)
- “MQTT Analogwertempfänger” (MQTT analog value receiver) (number of people)
- “MQTT Temperatursensor” (MQTT temperature sensor) (climate)
- “MQTT Kommunikationsstörung” (MQTT communication fault) (availability)
- for each detection zone in use, one more “MQTT Fenster-/Türkontakt” (MQTT window/door contact)
“Erstellen” (Create), then “Konfiguration speichern” (Save configuration).
-
In the CCU3, at the top right, go to “Geräte anlernen → Posteingang” (Teach-in devices → Inbox), and accept the device with “Fertig” (Done).
-
Under “Einstellungen → Geräte” (Settings → Devices), open the new device with “Einstellen” (Set) and enter the following:
| Channel | Parameter | Value |
|---|---|---|
| 1 (presence) | TOPIC | stat/<Hauptthema>/PRESENCE |
| 1 | OPEN_PATTERN | True |
| 1 | CLOSED_PATTERN | False |
| 1 | MATCHER | EXACT |
| 2 (people) | TOPIC | stat/<Hauptthema>/DETECTION |
| 2 | EXTRACTOR | ALL |
| 3 (climate) | TEMPERATURE_TOPIC | tele/<Hauptthema>/STATE |
| 3 | TEMPERATURE_EXTRACTOR | TEMPLATE |
| 3 | TEMPERATURE_PATTERN | {{with parseJSON .}}{{.temperature}}{{end}} |
| 3 | HUMIDITY_TOPIC | tele/<Hauptthema>/STATE |
| 3 | HUMIDITY_EXTRACTOR | TEMPLATE |
| 3 | HUMIDITY_PATTERN | {{with parseJSON .}}{{.humidity}}{{end}} |
| 4 (availability) | TOPIC | tele/<Hauptthema>/LWT |
| 4 | ERROR_PATTERN | Offline |
| 4 | OK_PATTERN | Online |
| 4 | ERROR_DELAY | 60 |
| 4 | OK_DELAY | 20 |
| 5 (zone 1) | TOPIC | stat/<Hauptthema>/ZONES/<ZONE1> |
| 5 | OPEN_PATTERN | True |
| 5 | CLOSED_PATTERN | False |
| 5 | MATCHER | EXACT |
| 6, 7, 8 (zones 2–4) | as channel 5 | with <ZONE2>, <ZONE3>, <ZONE4>
|
Only the value from the right-hand column goes into the field, including the curly braces for the patterns. True and False must be written exactly like this, with a capital first letter. If detection zone 1 is called Sofa, channel 5 contains stat/<Hauptthema>/ZONES/SOFA.
The values appear under “Status und Bedienung → Geräte” (Status and control → Devices). Presence and zones show “Offen” (open) as long as a person is detected, and “Verschlossen” (closed) when nobody is there. The CCU3 calls the number of people “Eingangsspannung” (input voltage). What is meant is the number of people. Availability shows “Verschlossen” as long as the sensor is connected, and “Offen” when it has been missing for more than a minute. Temperature and humidity arrive with the sensor's Publish interval.
Variant B: Home Control Unit (HCU)
With the MQTT plugin, the HCU is a client, not a broker. The sensor and the HCU therefore both connect to your broker.
- In HCUweb, open the configuration of the MQTT plugin. In the group “Neuer Broker” (New broker), enter the details of your broker and click “Broker hinzufügen” (Add broker).
- In the group “Neues Gerät” (New device), choose the device type for presence or occupancy sensors and your broker, then click “Neues Gerät” (New device).
- For the presence feature, enter the following and save:
| Field | Value |
|---|---|
| Topic | stat/<Hauptthema>/PRESENCE |
| Retained | Ja (yes) |
| Payload-Typ (payload type) | BOOLEAN |
- For each detection zone in use, create another device in the same way, with the topic
stat/<Hauptthema>/ZONES/<ZONE1>etc.
If the device also offers availability (feature “unreach”):
| Field | Value |
|---|---|
| Topic | tele/<Hauptthema>/LWT |
| Retained | Ja (yes) |
| Payload-Typ (payload type) | TEXT |
| Text-Mapping (text mapping) | {"Offline": "true", "Online": "false"} |
Do not enter a control topic: the presence sensor is only read.
Quick test
- Leave the room and wait for the timeout to run out: presence changes to “Verschlossen” (HCU: no presence). Walk into a detection zone: presence and zone change to “Offen”.
- Variant A only: Disconnect the sensor from power: after a good minute, availability changes to “Offen”, and after plugging it back in, it returns to “Verschlossen”.
Optional
Light on presence (variant A) under “Programme und Verknüpfungen → Programme & Zentralenverknüpfung” (Programs and connections → Programs & CCU connection). Set both conditions to “bei Änderung auslösen” (trigger when changed):
| Condition | Activity | |
|---|---|---|
| If | Presence Offen | Light: On |
| Otherwise, if | Presence Verschlossen | Light: Off |
Instead of the presence of the room, the channel of a zone also works, for example a reading lamp for “Sofa Offen”. You set the timeout on the sensor (Room timeout or Timeout per zone on the main page), not in the program.
Brightness and Air pressure (variant A): one more channel each of type “MQTT Analogwertempfänger” (MQTT analog value receiver):
| Parameter | Value |
|---|---|
| TOPIC | tele/<Hauptthema>/STATE |
| EXTRACTOR | TEMPLATE |
| PATTERN | {{with parseJSON .}}{{.brightness}}{{end}} |
For air pressure in hPa, the PATTERN contains .pressure instead of .brightness. The CCU3 calls both values “Eingangsspannung” (input voltage).
Limitations
- For CCU-Jack, the CCU3 has no presence sensor. The contact is the suitable channel for a yes/no state. “Offen” (open) means “person present” here.
- The channel of a zone is tied to the zone name. After a zone is renamed, it stays as it is until you have adjusted the topic. The factory name with a space (
DETECTION 1) has not been tested. Name the zones as described above. - After the CCU3 restarts, presence, zones, and number of people come back as soon as the sensor has reconnected; temperature and humidity only with the next status message.
- HCU: Set up only zones with a drawn area. For unused zones, the sensor sends an empty message, which the plugin rejects as an error. For the number of people, no route is described for the HCU.
- Homematic IP Access Point (HmIP-HAP, HAP2): third-party devices cannot be connected.
- Variant B is based on the manufacturer's description. There, temperature, humidity, and brightness could be obtained via a climate sensor from
tele/<Hauptthema>/STATE(payload typeJSON, JSON pointer, e.g.,/temperature), but this has not been worked out further.
Verification status
This guide is based on the CCU-Jack and Homematic IP documentation.