Loxone: Integrating the KL LD and KL presence sensors

Learn how to integrate the KL LD and KL presence sensors into Loxone, with all settings on the sensor and on 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 Miniserver and the sensor are connected to the same MQTT broker. The sensor reports every change in presence immediately. The Miniserver takes it over via Loxone's own MQTT (from Config 15.3, not Miniserver Gen. 1) and evaluates it at most every 2 seconds. Presence becomes 1/0 and can be used like a digital signal. In addition there are distance, brightness, temperature, humidity and air pressure, and the alarm sound can be switched. This applies equally to KL LD and KL.

Without a broker, or with a Miniserver Gen. 1, it also works through a Virtual HTTP Input (see Without a broker). However, the Miniserver then polls the sensor only every 10 seconds at most. That is how long it can take until the light comes on.

Replace the placeholders in this guide with your own values:

Placeholder Meaning
<Hauptthema> what is entered on the sensor under Connections → Main topic
<IP> IP address of the sensor, for the HTTP method and the alarm sound
<Login>, <Passwort> Login credentials of the sensor, for the HTTP method and the alarm sound, only when authentication is switched on

Requirements

  • Miniserver Gen. 2, Compact or Go with Loxone Config 15.3 or newer (for the HTTP method any Miniserver, including Gen. 1)
  • an MQTT broker on the network, e.g. Mosquitto on a NAS or a LoxBerry. The Miniserver is only a client, not a broker. Without a broker, the HTTP method remains.
  • KL LD presence sensor with firmware 1.1.3 or KL with firmware 3.2.3 (for older versions see Limitations) on the same network as the Miniserver

Setting up the sensor

Sensor web interface → Connections:

Field Value
Connection type MQTT Broker
Server, port those of the broker
Login, password only if the broker requires them
Client id unique, only letters, digits, _
Main topic free, only letters, digits, _
Home Assistant off (Loxone does not read the discovery)

Save. After a short while, the bottom of the page shows “connected”.

How long presence continues after the last detection is set on the sensor (main page, Timeout), not in Loxone.

Setup

  1. Select Network Periphery → Add network device → MQTT. Properties:

    Property Value
    Broker address IP address of the broker
    Broker port the same as on the sensor, usually 1883
    Client ID free, but different from the sensor's
    Username / password only if the broker requires them
  2. Select the MQTT object and add one Subscription for each value. A subscription delivers text. Follow it with the Command Recognition block (input T, output Lv):

    Topic of the subscription Command Recognition Lv
    stat/<Hauptthema>/PRESENCE \1 84 = someone there (True), 70 = nobody (False)
    stat/<Hauptthema>/DETECTION_DIST \v Distance of the person in cm, 0 = nobody there
    tele/<Hauptthema>/LWT \s1\1 110 = reachable (Online), 102 = not reachable (Offline)

    Turn 84/70 into the values 1/0, e.g. with the Formula block and the formula MAX(0;(I1-70)/14). MAX keeps the result at 0 in case the Command Recognition does not find a letter. For LWT, \s1 skips the first character, because both words start with O.

    Following the same pattern as presence, with \1 and the same formula: stat/<Hauptthema>/MOVING (moving person detected) and stat/<Hauptthema>/STATIONARY (stationary person detected).

  3. Brightness, temperature, humidity and air pressure are only available in the JSON: subscribe to tele/<Hauptthema>/STATE and follow it with one Command Recognition for each value:

    Value Command Recognition
    Brightness in lx \i"brightness": \i\v
    Temperature in °C \i"temperature": \i\v
    Humidity in % \i"humidity": \i\v
    Air pressure in hPa \i"pressure": \i\v

    Enter the patterns exactly as shown, with the space after the colon. The values arrive at the Publish interval of the sensor (on the sensor under Connections).

  4. Drag the Formula blocks onto a program page and connect presence to the input of the block that is to react (e.g. the lighting control). Save to the Miniserver.

At most 16 subscriptions per Miniserver. It evaluates changes every 2 seconds at the earliest. The broker keeps presence, distance and reachability ready, so after a restart of the Miniserver they are back right away.

Quick test

  1. Walk up and down in front of the sensor: in the live view, presence jumps to 1 after 2 seconds at most. Leave the room: after the timeout, it is at 0.
  2. The subscription to LWT shows the text Online, the Command Recognition behind it 110 (reachable).

Without a broker: Virtual HTTP Input

This method does not need a broker and also works on the Miniserver Gen. 1. However, the Miniserver polls the sensor only every 10 seconds. The sensor needs a fixed IP address for this (permanently assign the address in the router). The settings under “Setting up the sensor” are not needed for this method. Check in the browser whether the sensor responds: http://<IP>/measurements returns a line like

{"presence": true, "detection_dist": 200, "brightness": 221.2, "temperature": 21.5, "pressure": 1014.4, "humidity": 48.3, "zone": "Short", "moving_gate_energies": [21, 84, 46, 6, 10, 10, 6, 10, 6, 9, 6, 7, 8], "stationary_gate_energies": [19, 31, 15, 10, 9, 10, 9, 8, 9, 10, 8, 10, 8], "moving": true, "stationary": false, "moving_target_energy": 84, "stationary_target_energy": 0, "moving_target_dist": 200, "stationary_target_dist": 0}

The order of the fields is not fixed. The patterns below can handle that.

  1. In Loxone Config, select Virtual Inputs in the Periphery tree and add a Virtual HTTP Input. Properties:

    Property Value
    URL http://<IP>/measurements
    Polling cycle 10 (seconds, the smallest permitted value)
    Timeout 4000 (ms, permitted 10…8000)
    Number of allowed timeouts 5

    If Authentication is switched on at the sensor under System, the URL is http://<IP>/measurements?login=<Login>&password=<Passwort>.

  2. Select the HTTP input and add a Virtual HTTP Input Command for presence:

    Property Value
    Command Recognition \i"presence": \i\1
    Use as digital input off
    Correction: Input value 1 102
    Correction: Display value 1 0
    Correction: Input value 2 116
    Correction: Display value 2 1

    Enter the pattern exactly as shown, with the space after the colon. Background: in the JSON, presence is the word true or false, not a number. \i…\i jumps to the position after the given text, \1 reads the character code of the next letter: 116 for t (true), 102 for f (false). The correction turns these into 1 and 0.

    You read moving or stationary in the same way, with the same correction: \i"moving": \i\1 and \i"stationary": \i\1.

  3. Add further commands as you like, here without a correction:

    Value Command Recognition Result
    Distance of the person in cm \i"detection_dist": \i\v e.g. 200, 0 = nobody there
    Brightness in lx \i"brightness": \i\v e.g. 221.2
    Temperature in °C \i"temperature": \i\v e.g. 21.5
    Humidity in % \i"humidity": \i\v e.g. 48.3
    Air pressure in hPa \i"pressure": \i\v e.g. 1014.4

    \v reads the number that follows the text.

  4. Drag the commands onto a program page and connect presence to the input of the block that is to react (e.g. the lighting control). Save to the Miniserver.

Quick test: in the command, open the editing window of the Command Recognition. It shows the sensor's response, that is, the JSON line from above. Walk up and down in front of the sensor: in the live view, presence jumps to 1 after one polling cycle at the latest. Leave the room: after the timeout and one polling cycle, it is at 0.

Optional

Switching the alarm sound

The alarm sound is switched by a Virtual Output over HTTP, even if the other values arrive via MQTT. For the alarm sound, the sensor only accepts the words ON/OFF, not the numbers 1/0 that a digital output delivers.

  1. Select Virtual Outputs and add a Virtual Output:

    Property Value
    Address http://<IP>

    Only the address, with no path after it.

  2. Below it, add a Virtual Output Command:

    Property Value
    Command for ON /siren?turn=on
    Command for OFF /siren?turn=off

    If authentication is switched on at the sensor, append &login=<Login>&password=<Passwort> to both commands.

  3. On the program page, connect the command to the output that is to trigger the alarm sound (e.g. alarm system). You choose the sound itself on the sensor (main page, Sound).

LoxBerry with MQTT Gateway

Worthwhile if a LoxBerry is already running (the gateway and the broker have been built in since LoxBerry 3.0) or if the Miniserver Gen. 1 is to get MQTT.

  1. Enter the LoxBerry as the broker on the sensor. Server, port, user and password are found in the LoxBerry under System Settings → MQTT Gateway → MQTT Basics.
  2. On the Gateway tab under Text to Value Conversions, enter True=1 and False=0.
  3. On the Subscriptions tab, tick stat/<Hauptthema>/PRESENCE.
  4. On the Incoming Overview tab, copy the name (do not type it) and create a Virtual Input in Loxone Config with exactly this name, here stat_<Hauptthema>_PRESENCE.

Limitations

  • Loxone evaluates MQTT messages at most every 2 seconds. The HTTP method polls at most every 10 seconds. That is how long it can take there until the light comes on.
  • If the sensor fails, the last value stays (even a presence of 1). With MQTT, LWT shows 102 (not reachable) after a good 20 seconds. On the HTTP input, the Miniserver reports the failure after the set number of timeouts.
  • The HTTP method reads values and switches the alarm sound. Other settings of the sensor cannot be changed from Loxone.
  • The name of the zone arrives as text and cannot be read as a number. Use the distance instead and define ranges in Loxone.
  • The distance changes several times per second during movement. Loxone takes over at most one value every 2 seconds.
  • HTTP method: the IP address is fixed in the URL. If it changes, nothing arrives any more. With login, the password is in plain text in the URL.
  • Older firmware (KL LD up to 1.1.2, KL up to 3.2.2): After a restart of the sensor, the old presence value may remain on the broker until the first change. Update the firmware.

Verification status

This guide is based on the documentation from Loxone and LoxBerry.

Next

Manual

KL LD presence sensor

Mounting, connecting to Wi-Fi, setting up.

Manual

KL presence sensor

Mounting, connecting to Wi-Fi, setting up.

Smart home

All systems

An overview of the guides for all presence sensors and systems.

Support

Help and contact

Phone, email and contact form.