Homematic: Integrating the KL LD and KL presence sensors

Here is how to integrate the KL LD and KL presence sensors into Homematic, with all settings on the sensor and in the hub.

Applies to KL LD and KL · Sensor firmware KL LD 1.1.3, KL 3.2.3 and newer · As of 12/5/2026

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 appears as a Homematic contact and can be used in programs, for example to switch a light. In addition, there are temperature, humidity, and the availability of the sensor. The Home Control Unit (HCU) takes presence via its MQTT plugin and needs its own broker for that (variant B). The Homematic IP Access Point does not accept third-party sensors.

In the tables, <Hauptthema> stands for whatever is entered on the sensor under Connections → Main topic. Enter your own main topic there, without the angle brackets. Upper and lower case matter.

Requirements

  • KL LD presence sensor with firmware 1.1.3 or KL with firmware 3.2.3 (older ones also work, see Limitations), set up on Wi-Fi
  • 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

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, _

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. All topics are listed in the user manual.

Setup

Variant A: CCU3 with CCU-Jack

  1. 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).
  2. In the CCU3 firewall, open the ports 1883 and 2121.
  3. 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.
  4. Connect the sensor to CCU-Jack (section above).
  5. 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 three channels, in this order: “MQTT Fenster-/Türkontakt” (MQTT window/door contact), “MQTT Temperatursensor” (MQTT temperature sensor), “MQTT Kommunikationsstörung” (MQTT communication fault). “Erstellen” (Create), then “Konfiguration speichern” (Save configuration).
  6. In the CCU3, at the top right, go to “Geräte anlernen → Posteingang” (Teach-in devices → Inbox), and accept the device with “Fertig” (Done).
  7. 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 (climate) TEMPERATURE_TOPIC tele/<Hauptthema>/STATE
2 TEMPERATURE_EXTRACTOR TEMPLATE
2 TEMPERATURE_PATTERN {{with parseJSON .}}{{.temperature}}{{end}}
2 HUMIDITY_TOPIC tele/<Hauptthema>/STATE
2 HUMIDITY_EXTRACTOR TEMPLATE
2 HUMIDITY_PATTERN {{with parseJSON .}}{{.humidity}}{{end}}
3 (availability) TOPIC tele/<Hauptthema>/LWT
3 ERROR_PATTERN Offline
3 OK_PATTERN Online
3 ERROR_DELAY 60
3 OK_DELAY 20

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.

The values appear under “Status und Bedienung → Geräte” (Status and control → Devices). Presence shows “Offen” (open) as long as a person is detected, and “Verschlossen” (closed) when nobody is there. 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.

  1. 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).
  2. 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).
  3. For the presence feature, enter the following and save:
Field Value
Topic stat/<Hauptthema>/PRESENCE
Retained Ja (yes)
Payload-Typ (payload type) BOOLEAN

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 detection area and wait for the timeout to run out: presence changes to “Verschlossen” (HCU: no presence). Walk in: it changes 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), both conditions set to “bei Änderung auslösen” (trigger when changed):

Condition Activity
If Presence Offen Light: On
Otherwise, if Presence Verschlossen Light: Off

You set the timeout on the sensor (Settings → Timeout on the main page), not in the program.

Brightness (variant A): one more channel of type “MQTT Analogwertempfänger” (MQTT analog value receiver):

Parameter Value
TOPIC tele/<Hauptthema>/STATE
EXTRACTOR TEMPLATE
PATTERN {{with parseJSON .}}{{.brightness}}{{end}}

The CCU3 calls the value “Eingangsspannung” (input voltage); what is meant is lux.

Zone as a number (variant A): CCU-Jack cannot display text. An “MQTT Analogwertempfänger” (MQTT analog value receiver) turns the factory zones into the numbers 1 to 5, 0 means no zone:

Parameter Value
TOPIC stat/<Hauptthema>/ZONE
EXTRACTOR TEMPLATE
PATTERN see below
{{if eq . "Very Short" "Near"}}1{{else if eq . "Short" "Central"}}2{{else if eq . "Medium" "Away"}}3{{else if eq . "Long"}}4{{else if eq . "Very Long"}}5{{else}}0{{end}}

If you have renamed the zones under Zones, use your names instead.

Limitations

  • Do not pass the person's distance to the CCU3: as long as someone is moving, it changes several times per second, and every message is an event for the CCU3.
  • 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.
  • After the CCU3 restarts, presence comes back as soon as the sensor has reconnected. Temperature and humidity only arrive with the next status message.
  • Older firmware (KL LD up to 1.1.2, KL up to 3.2.2): after a restart of the sensor or the CCU3, presence may show the old value or no value until the next change. Update the firmware.
  • Homematic IP Access Point (HmIP-HAP, HAP2): third-party devices cannot be connected.
  • Variant B is compiled only from the manufacturer's description. There, temperature, humidity, and brightness could be obtained via a climate sensor from tele/<Hauptthema>/STATE (payload type JSON, JSON pointer, e.g., /temperature).

Verification status

This guide is based on the CCU-Jack documentation.

Next steps

Manual

KL LD presence sensor

Mounting, connecting to Wi-Fi, setup.

Manual

KL presence sensor

Mounting, connecting to Wi-Fi, setup.

Smart home

All systems

The guides for all presence sensors and systems at a glance.

Support

Help and contact

Phone, email, and contact form.