See what your presence sensor covers before you buy
Draw your room with furniture and doors, place a sensor and see where it detects presence. In the browser, on your phone too, no sign-up.
Time-controlled lighting automation often suffers from a fundamental problem that a presence sensor with a brightness sensor does not have: it ignores reality. At midday on a cloudy November day, a room may already be dark, while on a bright summer evening at 9 PM, no artificial light is needed.
The obvious countermeasure, using sunset as a trigger instead of a fixed time, only shifts the problem. While sunset time moves with the seasons, appearing dynamic, it remains at its core a calculated time. It knows nothing of dense cloud cover, a room's north-facing orientation, or lowered blinds. It merely estimates brightness instead of truly measuring it.
Control only becomes truly demand-driven when it evaluates the light actually arriving in your room and combines it with a second question: Are you there?
This is precisely what the KL MZ presence sensor's integrated brightness sensor enables, locally, without a cloud, and with direct Home Assistant integration.
The following components are required:
brightness_pct) and night light mode. Both require a dimmable light. The automation fundamentally works with a simple on/off switch too, but then the brightness gradations are omitted, and you remove the brightness_pct lines.localhost, Port: 1883.Security Tip: Create a separate MQTT user within the Mosquitto app instead of using anonymous connections or your main account. This keeps access cleanly separated and simplifies later troubleshooting.
Important: Which broker address do you enter for the sensor? The sensor is an independent device on the network and must always address the actual network address of your HA host (e.g., 192.168.1.100), never localhost. From the sensor's perspective, localhost would point to the sensor itself, not to Home Assistant. This applies regardless of whether HA runs as HAOS or in a Docker container. Only HA-internal communication to the broker runs via localhost. This refers to the MQTT integration from Step 1, not the sensor configuration in Step 2.
http://[Sensor-IP]). If your router supports name resolution, you can also use the hostname (e.g., http://hostname.fritz.box).192.168.1.100), not localhost.1883.wohnzimmer_praesenz).Why the main topic is so important: This name becomes part of all MQTT topics (e.g., tele/wohnzimmer_praesenz/STATE). Renaming it later means all automations must be adjusted. So, take your time to consider the name.
Status Check: You can directly check if the connection is successful in the sensor's configuration menu. The current connection status is displayed in the bottom left. If it says "disconnected," there is no connection to the broker, and no data is transmitted to Home Assistant.
After correct MQTT configuration and the HA switch being activated, the presence sensor will be automatically discovered and configured by Home Assistant.
binary_sensor.wohnzimmer_praesenz_presence (Presence: ON / OFF)sensor.wohnzimmer_praesenz_illuminance (Lux value, numerical)We deliberately create two thresholds: one for turning on and a higher one for turning off. The reason is hysteresis. With only a single threshold, the light would flicker second by second at dusk as the measured brightness fluctuates around that single value. You can find more about this in the box below.
We create both values as number helpers. This way, you can easily readjust them later via the dashboard, without any code changes.
Navigate to Settings → Devices & Services → Helpers → Create Helper → Number and create two helpers:
Helper 1: On Threshold
Lux EIN-Schwelle Wohnzimmer (keep the helper names in German exactly as shown; Home Assistant derives the entity IDs used below from them)
lx
200
Helper 2: Off Threshold
Lux AUS-Schwelle Wohnzimmer
lx
400
Why two thresholds instead of one? If ON and OFF had the same value (e.g., 200 lx), an endless loop would occur: the light turns on → its own lamp raises the measured brightness above 200 lx → the light turns off again → the room is dark → the light turns on again. By having a gap between turning on (below 200 lx) and turning off (above 400 lx), this effect is prevented.
Navigate to Settings → Automations → Create Automation → Start with an empty automation and insert the following YAML code:
alias: "Living Room: Turn on light with presence and darkness"
description: >
Turns on the light when the Senvolon presence detector detects presence AND
the Lux value falls below the ON threshold. In absolute darkness, a
gentle night light mode is used.
triggers:
- trigger: state
entity_id: binary_sensor.wohnzimmer_praesenz_presence
to: "on"
id: presence_detected
- trigger: numeric_state
entity_id: sensor.wohnzimmer_praesenz_illuminance
below: input_number.lux_ein_schwelle_wohnzimmer
for:
minutes: 1
id: lux_dropped
# Debouncing: short brightness fluctuations are ignored.
conditions:
- condition: state
entity_id: binary_sensor.wohnzimmer_praesenz_presence
state: "on"
- condition: numeric_state
entity_id: sensor.wohnzimmer_praesenz_illuminance
below: input_number.lux_ein_schwelle_wohnzimmer
- condition: state
entity_id: light.deckenlampe_tv
state: "off"
# Logic:
# The light only turns on if someone is present, the room is dark enough,
# and the light is currently off.
actions:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.wohnzimmer_praesenz_illuminance
below: 15
sequence:
- action: light.turn_on
target:
entity_id: light.deckenlampe_tv
data:
brightness_pct: 15
transition: 2
default:
- action: light.turn_on
target:
entity_id: light.deckenlampe_tv
data:
brightness_pct: 80
transition: 1
mode: single
The logic behind it: The light only turns on if both conditions are met (presence detected + room is dark), regardless of which event occurs first.
The "Night Light" Mode without Fixed Times
The light only turns on when it's dark. But how bright should it be? If you get a glass of water at 3 AM, 80% brightness is like an interrogation spotlight.
Since we are building smart brightness control, we simply use the Senvolon sensor's lux value to differentiate between "twilight" and "deep night," without fixed times. This is exactly what the choose block above does:
alias: "Living Room: Turn off light with absence or sufficient daylight"
description: >
Turns off the light when no presence is detected OR the Lux value
rises above the higher OFF threshold.
triggers:
- trigger: state
entity_id: binary_sensor.wohnzimmer_praesenz_presence
to: "off"
id: no_presence
- trigger: numeric_state
entity_id: sensor.wohnzimmer_praesenz_illuminance
above: input_number.lux_aus_schwelle_wohnzimmer
for:
minutes: 2
id: lux_sufficient
# Buffer: short brightness peaks do not trigger shutdown.
conditions: []
actions:
- action: light.turn_off
target:
entity_id: light.deckenlampe_tv
mode: single
Why the higher threshold and the for: 2min?
Turning off only takes effect when the measured brightness exceeds the OFF threshold (e.g., 400 lx), and only then if this state persists for two minutes. This prevents a short burst of brightness or the lamp's own light from abruptly turning off the light. Turning off due to absence (no_presence) occurs immediately, as there's no reason to wait here.
To make the effort of creating two helpers worthwhile, we'll create a small Lovelace card. It shows both thresholds for adjustment, as well as the current lux value and presence status, which is ideal for later fine-tuning. Simply open your dashboard, click on Add Card > Manual, and insert the following:
type: vertical-stack
cards:
- type: entities
title: Light Control by Lux Value
entities:
- entity: input_number.lux_ein_schwelle_wohnzimmer
name: ON Threshold
- entity: input_number.lux_aus_schwelle_wohnzimmer
name: OFF Threshold
- entity: sensor.wohnzimmer_praesenz_illuminance
name: Current Brightness
- entity: binary_sensor.wohnzimmer_praesenz_presence
name: Presence
- type: entities
title: Light
entities:
- entity: light.deckenlampe_tv
name: Ceiling Lamp
Tip for setting: Observe over a day what lux value is displayed on the card when you feel the light is currently needed. That is your ON value. Set the OFF threshold significantly higher (rule of thumb: double) to ensure enough separation.
Why isn't the night value also a helper? This is a conscious decision. In this guide, you work with three lux limits: the ON threshold, the OFF threshold, and the night limit (the below: 15 in the choose block of the ON automation, which switches between 80% and 15% brightness). You calibrate the first two empirically over several days, which is why they are on the dashboard as helpers.
The night limit ("practically pitch black"), on the other hand, is almost never adjusted, which is why it remains fixed in the automation for simplicity.
As a rule of thumb: values that you regularly tweak should be moved to helpers. Pure structural values that never change can be directly in the YAML. This includes the night limit or the debounce times (for: 1min and for: 2min). You could theoretically have hardcoded all three values into the automation. The helpers simply make adjustments more convenient, without opening the editor every time.
Do you want to adjust the night value more often? Then simply create a third helper using the same pattern and replace below: 15 with below: input_number.lux_nacht_schwelle_wohnzimmer.
Brightness cannot be calibrated with an offset: Unlike temperature, humidity, and air pressure, the sensor does not offer an offset for brightness correction. If your sensor systematically measures too bright or too dark, do not correct this with an offset, but directly via the lux thresholds themselves. That's exactly what the helpers on the dashboard are for.
Lux automation reacts slowly: Presence is reported immediately, but the lux value via MQTT is only reported every 5 minutes by default (publish interval). For lighting control, this is usually not critical because daylight changes slowly anyway. If you want it more reactive, you can reduce the transmission interval in the sensor's MQTT configuration.
False alarms due to interfering objects: Movements from fans or air conditioners can be detected by the radar sensor. Four zones are available for excluding interference. Besides drawing them by hand, the presence sensor can also detect sources of interference itself: with the “Learn room” function it creates interference zones in the empty room. After the confirmation prompt you have 20 seconds to leave the room. Step by step: Setting up zones on the KL MZ presence sensor.
Optimize timeout (DELAY): The timeout determines how long presence is maintained after a zone has been left. Thanks to 60 GHz FMCW radar technology, which registers even the slightest movements like breathing, even people sitting still or sleeping are detected up to about 4 m away; for a sofa or bed, set up a stay zone. Extremely long timeouts, as with classic infrared detectors, are unnecessary; values between 15 and 30 seconds are usually sufficient.
Light flickers or constantly switches: This is almost always a threshold or placement problem. Check whether the ON and OFF thresholds have enough distance and whether the controlled lamp directly illuminates the sensor. When in doubt, you should move the sensor or increase the distance between the thresholds.
Sensor does not appear in HA: Check whether the "Home Assistant" switch has been activated and saved in the sensor's web app. Take a look at the sensor's MQTT broker configuration menu: if the status at the bottom left is "disconnected", something is blocking communication. Also, check the Mosquitto log to see if the connection from the sensor was successfully established.
With our KL MZ presence sensor and Home Assistant, you get a lighting control that is truly intelligent and dynamic. It provides no unnecessary artificial light during daylight, no light cutting out while you sit still, a soft night light in complete darkness, and thanks to the two thresholds, no annoying flickering at dusk. All of this works 100% locally.
Learn more about our presence sensors and their advanced functions, from zone-based room monitoring to multi-person tracking, directly on our KL MZ presence sensor product page.
Basics: Adding a presence sensor to Home Assistant · Presence sensor or motion detector?
All models compared: Presence sensors
Draw your room with furniture and doors, place a sensor and see where it detects presence. In the browser, on your phone too, no sign-up.