Node-RED: Integrating the KL MZ multi-zone presence sensor

Learn how to integrate the KL MZ multi-zone presence sensor into Node-RED, with all settings on the sensor and on the hub.

Applies to KL MZ · Sensor firmware 1.4.3 and newer · As of 11/30/2026

Contents

Node-RED reads the sensor's messages via MQTT from your broker. The built-in MQTT nodes are enough for this. This guide contains a ready-made flow that you import once by hand. With the add-on package “Dashboard 2.0”, it shows presence, number of people, the occupancy of the detection zones, availability, temperature, humidity, air pressure and brightness. There you set the LED and the timeout, and you play a sound on the sensor. Node-RED has no automatic detection of the sensor. An appendix describes how Node-RED writes the values to a KNX bus.

In this guide, <Hauptthema> stands for the value entered on the sensor under Connections → Main topic. Replace it everywhere with your own value, without the angle brackets. In the flow itself, HAUPTTHEMA stands for it, see step 2.

<ZONE1> … <ZONE4> stands for the name of detection zone 1 … 4 as it appears in the topic: in capital letters. If the zone is called Kueche on the sensor, the topic is stat/<Hauptthema>/ZONES/KUECHE. The flow itself does not need these names. You only need them under Optional and in the KNX appendix.

Prerequisites

  • Node-RED is already running. This guide describes Node-RED 5.0.10. The flow uses the built-in nodes mqtt in, mqtt out, change, switch and function.
  • For the display, the package @flowfuse/node-red-dashboard (“Dashboard 2.0”), here version 1.37.0. It requires Node-RED 3.0 or newer.
  • An MQTT broker (e.g. Mosquitto) that both the sensor and Node-RED can reach.
  • KL MZ multi-zone presence sensor with firmware 1.4.3 or newer.

Setting up the sensor

  1. Open the sensor's web interface, menu Connections:

    Field Value
    Connection type MQTT Broker
    Server Name or IP address of your broker
    Port 1883
    Login / password only if your broker requires them
    Main topic free choice, preferably letters, digits and _ only

    Save. The switch Home Assistant is not needed for Node-RED.

  2. Name the zones: On the main page, open Zones → Zone names and give each detection zone in use a short name:

    Field Value
    Detection zone 1 … 4 e.g. Kueche (letters, digits and _ only, no spaces)

    Click Save. Do not rename the zones afterwards: The name is part of the topic. Automations that use the old name no longer work afterwards.

All fields and messages of the sensor are described in the user manual.

Setup

Menu and field names depend on your browser language. This guide uses the English names. The labels inside the flow (for example “Anwesenheit”) are German.

  1. Install the dashboard (skip if already installed): menu at the top right → Manage palette → tab Install and enter in the search field:

    Field Value
    Search field @flowfuse/node-red-dashboard

    On the matching result, click Install to add it.

  2. Prepare the flow: Copy the flow from the section Flow into a text editor and change it there with “Find and replace”:

    Find Replace with
    HAUPTTHEMA Your main topic

    There are 11 occurrences.

  3. Import the flow: Menu → Import, paste the changed text into the field and click Import to finish. A new tab “Präsenzmelder KL MZ” appears.

  4. Enter the broker: In the new tab, double-click one of the purple MQTT nodes, then click the pencil next to the Server field. Then enter:

    Field Value
    Server Name or IP address of your broker (replaces BROKER-ADRESSE)
    Port 1883

    If your broker requires a login, go to the tab Security and enter:

    Field Value
    Username Broker user
    Password Broker password

    Close with Update and Done. The setting applies to all MQTT nodes in the flow.

  5. At the top right, click Deploy to apply the changes.

Quick test

  1. After a few seconds, the text connected appears under the MQTT nodes.
  2. Open the dashboard: http://<Adresse von Node-RED>:1880/dashboard/kl-mz or, in the right sidebar, Dashboard 2.0 → Open Dashboard in the browser.
  3. Presence, people, zones, connection and the ambient values appear right after opening because the broker keeps the last state. Under “Zonen” (zones), each detection zone in use is shown with belegt (occupied) or frei (free).
  4. Walk into a detection zone: “Anwesenheit” (presence) jumps to anwesend (present), “Personen” (people) counts along, and the zone shows belegt (occupied). Leave the room: After the timeout it shows abwesend (absent).

If everything stays empty although “connected” is shown, the main topic is almost always wrong. Mind upper and lower case.

Optional

Presence for automations. Attach a switch node to the mqtt in node with the topic stat/<Hauptthema>/PRESENCE:

Field in the switch node Value
Property msg.payload
first rule ==, type string, value True
second rule ==, type string, value False

The first output reports “someone there”, the second “nobody there”, e.g. for light on and off. The sensor sends True and False as text with a capital first letter. A comparison with the boolean true never matches. It also sends True again when only the number of people changes. So switch on the value, not on the arrival of a message.

One zone for automations. The node “Zonen sammeln” (collect zones) has a second output: For each message it delivers the zone name in msg.topic and the occupancy as a boolean true/false in msg.payload. Attach a switch node there:

Field in the switch node Value
Property msg.topic
Rule ==, type string, value <ZONE1>

Only the messages of this zone arrive behind it. If a zone is reported empty (area deleted or zone renamed), nothing arrives there, not even “free”.

Further settings. The flow sets the LED and the room timeout and plays sounds. Other values work the same way with an mqtt out node:

Field in the mqtt out node Value
Topic cmnd/<Hauptthema>/ALERT_MODE (more names in the user manual)
Retain falsch (false in the English interface)

A whole number without a unit is sent (e.g. 1), and for switches such as SIREN the text ON or OFF. The sensor does not accept 1 and 0 for switches. It discards invalid values without feedback. Retain must be set explicitly to falsch (false): If the field stays empty, Node-RED adopts the retain flag of the previously received message, and the broker repeats your command every time the sensor logs in again.

Query values immediately. An inject node with any content on an mqtt out node with the topic cmnd/<Hauptthema>/UPDATE (Retain falsch (false)) makes the sensor immediately send the status message with the ambient values and the presence.

Without MQTT. An http request node for http://<IP des Sensors>/measurements with the return set to “a parsed JSON object” delivers presence, number of people, zones and ambient values without a broker. The zones appear there with their name as entered (not in capital letters). The only thing that can be set this way is the siren (/siren?turn=on or ?turn=off). If Authentication is switched on on the sensor under System, append ?login=<Login>&password=<Passwort> to the address.

Limitations

  • Temperature, humidity, air pressure and brightness are only in the status message tele/<Hauptthema>/STATE. They therefore change in the dashboard only at the pace of the Publish interval (factory value 5 minutes). If the sensor cannot read a value, – is shown there.
  • The flow finds the zones via the topic stat/<Hauptthema>/ZONES/+. The name in the dashboard is the one from the topic, i.e. in capital letters. The factory name Detection 1 appears as DETECTION 1. A zone name with / does not appear.
  • After renaming a zone, the old name disappears immediately, the new one appears right after.
  • The slider “Nachlauf Raum” (room timeout) ranges from 0 to 120 seconds, as on the sensor. Timeout per zone, alert, sensitivity and trigger speed you set in the sensor's web interface or following the pattern under Optional.
  • “Abspielen” (play) plays the sound chosen in “Ton” (sound) once, and without a selection the sound Standard. After a restart of Node-RED the selection is empty.
  • The flow includes its own dashboard interface at /dashboard. If you already run a Dashboard 2.0, afterwards assign the page “KL MZ” to the existing interface and delete the included one.
  • Encryption (TLS) and login to the broker are set on the broker node.

Flow

Before importing, replace HAUPTTHEMA (step 2).

[
 {"id":"km_tab","type":"tab","label":"Präsenzmelder KL MZ","disabled":false,"info":""},
 {"id":"km_broker","type":"mqtt-broker","name":"Broker KL MZ","broker":"BROKER-ADRESSE","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":4,"keepalive":60,"cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},
 {"id":"km_base","type":"ui-base","name":"Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true,"allowInstall":false},
 {"id":"km_theme","type":"ui-theme","name":"Standard","colors":{"surface":"#fcfcfd","primary":"#0d74ce","bgPage":"#f9f9fb","groupBg":"#ffffff","groupOutline":"#d9d9e0"},"sizes":{"density":"default","pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px"}},
 {"id":"km_page","type":"ui-page","name":"KL MZ","ui":"km_base","path":"/kl-mz","icon":"account-multiple","layout":"grid","theme":"km_theme","breakpoints":[{"name":"Default","px":0,"cols":3},{"name":"Tablet","px":576,"cols":6},{"name":"Small Desktop","px":768,"cols":9},{"name":"Desktop","px":1024,"cols":12}],"tabs":[],"order":1,"className":"","visible":"true","disabled":"false"},
 {"id":"km_grp","type":"ui-group","name":"Raum","page":"km_page","width":4,"height":1,"order":1,"showTitle":true,"className":"","visible":"true","disabled":"false","groupType":"default","keepLoaded":false,"tab":""},
 {"id":"km_grp_env","type":"ui-group","name":"Umgebung","page":"km_page","width":4,"height":1,"order":2,"showTitle":true,"className":"","visible":"true","disabled":"false","groupType":"default","keepLoaded":false,"tab":""},
 {"id":"km_grp_set","type":"ui-group","name":"Einstellen","page":"km_page","width":4,"height":1,"order":3,"showTitle":true,"className":"","visible":"true","disabled":"false","groupType":"default","keepLoaded":false,"tab":""},
 {"id":"km_in_pres","type":"mqtt in","z":"km_tab","name":"","topic":"stat/HAUPTTHEMA/PRESENCE","qos":"0","datatype":"utf8","broker":"km_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":200,"y":80,"wires":[["km_c_pres"]]},
 {"id":"km_c_pres","type":"change","z":"km_tab","name":"True/False in Text","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload = \"True\" ? \"anwesend\" : \"abwesend\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":80,"wires":[["km_t_pres"]]},
 {"id":"km_t_pres","type":"ui-text","z":"km_tab","group":"km_grp","order":1,"width":0,"height":0,"name":"Anwesenheit","label":"Anwesenheit","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":true,"className":"","value":"payload","valueType":"msg","x":760,"y":80,"wires":[]},
 {"id":"km_in_det","type":"mqtt in","z":"km_tab","name":"","topic":"stat/HAUPTTHEMA/DETECTION","qos":"0","datatype":"auto-detect","broker":"km_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":200,"y":140,"wires":[["km_sw_det"]]},
 {"id":"km_sw_det","type":"switch","z":"km_tab","name":"nur Zahlen","property":"payload","propertyType":"msg","rules":[{"t":"istype","v":"number","vt":"number"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":140,"wires":[["km_t_det"]]},
 {"id":"km_t_det","type":"ui-text","z":"km_tab","group":"km_grp","order":2,"width":0,"height":0,"name":"Personen","label":"Personen","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":true,"className":"","value":"payload","valueType":"msg","x":760,"y":140,"wires":[]},
 {"id":"km_in_zones","type":"mqtt in","z":"km_tab","name":"","topic":"stat/HAUPTTHEMA/ZONES/+","qos":"0","datatype":"utf8","broker":"km_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":200,"y":200,"wires":[["km_f_zones"]]},
 {"id":"km_f_zones","type":"function","z":"km_tab","name":"Zonen sammeln","func":"const name = msg.topic.substring(msg.topic.lastIndexOf(\"/\") + 1);\nconst s = String(msg.payload).trim();\nconst zonen = context.get(\"zonen\") || {};\nif (s === \"True\" || s === \"False\") {\n    zonen[name] = (s === \"True\");\n} else if (s === \"\" && name in zonen) {\n    delete zonen[name];\n} else {\n    return null;\n}\ncontext.set(\"zonen\", zonen);\nconst namen = Object.keys(zonen).sort();\nconst text = namen.length ? namen.map(n => n + \": \" + (zonen[n] ? \"belegt\" : \"frei\")).join(\", \") : \"keine\";\nreturn [{ payload: text }, s === \"\" ? null : { topic: name, payload: zonen[name] }];","outputs":2,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"outputLabels":["Text fürs Dashboard","je Zone: true/false"],"x":470,"y":200,"wires":[["km_t_zones"],[]]},
 {"id":"km_t_zones","type":"ui-text","z":"km_tab","group":"km_grp","order":3,"width":0,"height":0,"name":"Zonen","label":"Zonen","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":true,"className":"","value":"payload","valueType":"msg","x":760,"y":200,"wires":[]},
 {"id":"km_in_lwt","type":"mqtt in","z":"km_tab","name":"","topic":"tele/HAUPTTHEMA/LWT","qos":"0","datatype":"utf8","broker":"km_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":200,"y":260,"wires":[["km_t_lwt"]]},
 {"id":"km_t_lwt","type":"ui-text","z":"km_tab","group":"km_grp","order":4,"width":0,"height":0,"name":"Verbindung","label":"Verbindung","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":true,"className":"","value":"payload","valueType":"msg","x":760,"y":260,"wires":[]},
 {"id":"km_in_state","type":"mqtt in","z":"km_tab","name":"","topic":"tele/HAUPTTHEMA/STATE","qos":"0","datatype":"json","broker":"km_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":200,"y":340,"wires":[["km_c_temp","km_c_hum","km_c_air","km_c_bri"]]},
 {"id":"km_c_temp","type":"change","z":"km_tab","name":"Temperatur aus JSON","rules":[{"t":"set","p":"payload","pt":"msg","to":"$type(payload.temperature) = \"number\" ? $formatNumber(payload.temperature, \"0,0\", {\"decimal-separator\": \",\", \"grouping-separator\": \".\"}) & \" °C\" : \"–\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":320,"wires":[["km_t_temp"]]},
 {"id":"km_t_temp","type":"ui-text","z":"km_tab","group":"km_grp_env","order":1,"width":0,"height":0,"name":"Temperatur","label":"Temperatur","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":true,"className":"","value":"payload","valueType":"msg","x":760,"y":320,"wires":[]},
 {"id":"km_c_hum","type":"change","z":"km_tab","name":"Luftfeuchte aus JSON","rules":[{"t":"set","p":"payload","pt":"msg","to":"$type(payload.humidity) = \"number\" ? $formatNumber(payload.humidity, \"0\", {\"decimal-separator\": \",\", \"grouping-separator\": \".\"}) & \" %\" : \"–\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":360,"wires":[["km_t_hum"]]},
 {"id":"km_t_hum","type":"ui-text","z":"km_tab","group":"km_grp_env","order":2,"width":0,"height":0,"name":"Luftfeuchte","label":"Luftfeuchte","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":true,"className":"","value":"payload","valueType":"msg","x":760,"y":360,"wires":[]},
 {"id":"km_c_air","type":"change","z":"km_tab","name":"Luftdruck aus JSON","rules":[{"t":"set","p":"payload","pt":"msg","to":"$type(payload.pressure) = \"number\" ? $formatNumber(payload.pressure, \"0,0\", {\"decimal-separator\": \",\", \"grouping-separator\": \".\"}) & \" hPa\" : \"–\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":400,"wires":[["km_t_air"]]},
 {"id":"km_t_air","type":"ui-text","z":"km_tab","group":"km_grp_env","order":3,"width":0,"height":0,"name":"Luftdruck","label":"Luftdruck","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":true,"className":"","value":"payload","valueType":"msg","x":760,"y":400,"wires":[]},
 {"id":"km_c_bri","type":"change","z":"km_tab","name":"Helligkeit aus JSON","rules":[{"t":"set","p":"payload","pt":"msg","to":"$type(payload.brightness) = \"number\" ? $formatNumber(payload.brightness, \"0\", {\"decimal-separator\": \",\", \"grouping-separator\": \".\"}) & \" lx\" : \"–\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":440,"wires":[["km_t_bri"]]},
 {"id":"km_t_bri","type":"ui-text","z":"km_tab","group":"km_grp_env","order":4,"width":0,"height":0,"name":"Helligkeit","label":"Helligkeit","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":true,"className":"","value":"payload","valueType":"msg","x":760,"y":440,"wires":[]},
 {"id":"km_in_leds","type":"mqtt in","z":"km_tab","name":"","topic":"stat/HAUPTTHEMA/LEDS","qos":"0","datatype":"utf8","broker":"km_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":200,"y":520,"wires":[["km_c_leds"]]},
 {"id":"km_c_leds","type":"change","z":"km_tab","name":"True/False in ON/OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload = \"True\" ? \"ON\" : \"OFF\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":520,"wires":[["km_sw_leds"]]},
 {"id":"km_sw_leds","type":"ui-switch","z":"km_tab","name":"LED","label":"LED","group":"km_grp_set","order":1,"width":0,"height":0,"passthru":false,"decouple":false,"topic":"topic","topicType":"msg","style":"","className":"","layout":"row-spread","clickableArea":"switch","onvalue":"ON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"OFF","offvalueType":"str","officon":"","offcolor":"","x":760,"y":520,"wires":[["km_out_leds"]]},
 {"id":"km_out_leds","type":"mqtt out","z":"km_tab","name":"","topic":"cmnd/HAUPTTHEMA/LEDS","qos":"0","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"km_broker","x":1000,"y":520,"wires":[]},
 {"id":"km_in_delay","type":"mqtt in","z":"km_tab","name":"","topic":"stat/HAUPTTHEMA/DELAY","qos":"0","datatype":"auto-detect","broker":"km_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":200,"y":580,"wires":[["km_sw_delay"]]},
 {"id":"km_sw_delay","type":"switch","z":"km_tab","name":"nur Zahlen","property":"payload","propertyType":"msg","rules":[{"t":"istype","v":"number","vt":"number"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":580,"wires":[["km_sl_delay"]]},
 {"id":"km_sl_delay","type":"ui-slider","z":"km_tab","group":"km_grp_set","name":"Nachlauf Raum","label":"Nachlauf Raum (s)","tooltip":"","order":2,"width":0,"height":0,"passthru":false,"outs":"end","topic":"topic","topicType":"msg","thumbLabel":"always","showTicks":"false","min":0,"max":120,"step":1,"className":"","iconPrepend":"","iconAppend":"","color":"","colorTrack":"","colorThumb":"","showTextField":true,"x":760,"y":580,"wires":[["km_out_delay"]]},
 {"id":"km_out_delay","type":"mqtt out","z":"km_tab","name":"","topic":"cmnd/HAUPTTHEMA/DELAY","qos":"0","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"km_broker","x":1000,"y":580,"wires":[]},
 {"id":"km_dd_ton","type":"ui-dropdown","z":"km_tab","group":"km_grp_set","name":"Ton","label":"Ton","tooltip":"","order":3,"width":0,"height":0,"passthru":false,"multiple":false,"chips":false,"clearable":false,"options":[{"label":"Standard","value":"0","type":"str"},{"label":"Martinshorn","value":"1","type":"str"},{"label":"Wecker","value":"2","type":"str"},{"label":"Räumung","value":"3","type":"str"},{"label":"Türklingel","value":"4","type":"str"},{"label":"Gong","value":"5","type":"str"},{"label":"SENVOLON","value":"6","type":"str"},{"label":"Für Elise","value":"7","type":"str"},{"label":"Bergkönig","value":"8","type":"str"},{"label":"Europahymne","value":"9","type":"str"},{"label":"Wiegenlied","value":"10","type":"str"},{"label":"Entertainer","value":"11","type":"str"},{"label":"Rhapsody","value":"12","type":"str"},{"label":"Boléro","value":"13","type":"str"},{"label":"Fanfare","value":"14","type":"str"}],"payload":"","topic":"topic","topicType":"msg","className":"","typeIsComboBox":false,"msgTrigger":"onChange","x":200,"y":660,"wires":[["km_c_ton"]]},
 {"id":"km_c_ton","type":"change","z":"km_tab","name":"Ton merken","rules":[{"t":"set","p":"klmz_ton","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":660,"wires":[[]]},
 {"id":"km_bt_play","type":"ui-button","z":"km_tab","group":"km_grp_set","name":"Abspielen","label":"Abspielen","order":4,"width":0,"height":0,"emulateClick":false,"tooltip":"","color":"","bgcolor":"","className":"","icon":"play","iconPosition":"left","payload":"","payloadType":"str","topic":"topic","topicType":"msg","buttonColor":"","textColor":"","iconColor":"","enableClick":true,"enablePointerdown":false,"pointerdownPayload":"","pointerdownPayloadType":"str","enablePointerup":false,"pointerupPayload":"","pointerupPayloadType":"str","x":200,"y":720,"wires":[["km_f_ton"]]},
 {"id":"km_f_ton","type":"function","z":"km_tab","name":"gewählten Ton senden","func":"const ton = flow.get(\"klmz_ton\");\nmsg.payload = (ton === undefined) ? \"0\" : String(ton);\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":470,"y":720,"wires":[["km_out_play"]]},
 {"id":"km_bt_stop","type":"ui-button","z":"km_tab","group":"km_grp_set","name":"Stopp","label":"Stopp","order":5,"width":0,"height":0,"emulateClick":false,"tooltip":"","color":"","bgcolor":"","className":"","icon":"stop","iconPosition":"left","payload":"STOP","payloadType":"str","topic":"topic","topicType":"msg","buttonColor":"","textColor":"","iconColor":"","enableClick":true,"enablePointerdown":false,"pointerdownPayload":"","pointerdownPayloadType":"str","enablePointerup":false,"pointerupPayload":"","pointerupPayloadType":"str","x":200,"y":780,"wires":[["km_out_play"]]},
 {"id":"km_out_play","type":"mqtt out","z":"km_tab","name":"","topic":"cmnd/HAUPTTHEMA/PLAY","qos":"0","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"km_broker","x":1000,"y":750,"wires":[]},
 {"id":"km_in_play","type":"mqtt in","z":"km_tab","name":"","topic":"stat/HAUPTTHEMA/PLAY","qos":"0","datatype":"utf8","broker":"km_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":200,"y":840,"wires":[["km_c_play"]]},
 {"id":"km_c_play","type":"change","z":"km_tab","name":"Nummer in Tonname","rules":[{"t":"set","p":"payload","pt":"msg","to":"($n := $contains(payload, /^[0-9]+$/) ? $number(payload) : -1; $n >= 0 and $n <= 14 ? [\"Standard\",\"Martinshorn\",\"Wecker\",\"Räumung\",\"Türklingel\",\"Gong\",\"SENVOLON\",\"Für Elise\",\"Bergkönig\",\"Europahymne\",\"Wiegenlied\",\"Entertainer\",\"Rhapsody\",\"Boléro\",\"Fanfare\"][$n] : \"keiner\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":840,"wires":[["km_t_play"]]},
 {"id":"km_t_play","type":"ui-text","z":"km_tab","group":"km_grp_set","order":6,"width":0,"height":0,"name":"Ton läuft","label":"Ton läuft","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":true,"className":"","value":"payload","valueType":"msg","x":760,"y":840,"wires":[]}
]

Appendix: KNX via knx-ultimate

With the package node-red-contrib-knx-ultimate (via Manage palette, Node-RED 3.1.1 or newer on Node.js 20.18.1 or newer), Node-RED writes the values of the sensor to group addresses. Create them in the ETS first. The addresses are examples and the same as in KNX: Integrating the KL MZ multi-zone presence sensor:

Value Source on the sensor Group address (example) Datapoint
Presence stat/<Hauptthema>/PRESENCE 6/0/1 1.018 (occupancy)
Number of people stat/<Hauptthema>/DETECTION 6/0/2 5.010 (counter pulses 0 … 255)
Detection zone 1 … 4 stat/<Hauptthema>/ZONES/<ZONE1> … <ZONE4> 6/0/11 … 6/0/14 1.018 (occupancy)
Brightness in lx brightness from tele/<Hauptthema>/STATE 6/0/3 9.004
Temperature in °C temperature from tele/<Hauptthema>/STATE 6/0/4 9.001
Humidity in % humidity from tele/<Hauptthema>/STATE 6/0/5 9.007
Air pressure in Pa pressure from tele/<Hauptthema>/STATE, times 100 6/0/6 14.058
Sensor reachable tele/<Hauptthema>/LWT 6/0/8 1.002
  1. In Node-RED, drag a KNX Device node onto the canvas and set up the connection to the bus via the field Gateway:

    Field Value
    Gateway IP address of the KNX IP interface (for a router 224.0.23.12)
    Gateway port 3671
    Connection protocol Auto (interface: Tunnel UDP, router: Multicast)
    KNX Physical Address a free physical address on the line, e.g. 1.1.250
  2. For each row of the table, create a KNX Device node:

    Field Value
    Group address e.g. 6/0/1
    Datapoint e.g. 1.018
    Send payload to the KNX BUS only on change (RBE filter) enabled
  3. Presence: Create an mqtt in node and connect it via a function node to the KNX node 6/0/1:

    Field (mqtt in) Value
    Server IP address of the broker, port 1883
    Topic stat/<Hauptthema>/PRESENCE
    Output Ein String (a String)

    Content of the function node (turns True/False into a boolean and does not let anything else onto the bus):

    const s = String(msg.payload).trim();
    if (s !== "True" && s !== "False") return null;
    msg.payload = (s === "True");
    return msg;
    
  4. Zones: For each detection zone in use, create the same: an mqtt in node with the topic stat/<Hauptthema>/ZONES/<ZONE1> (or <ZONE2> …, output Ein String (a String)), the same function content as in step 3 and the KNX node 6/0/11 (or 6/0/12 …). The function node does not let the empty message of an unused or renamed zone onto the bus.

  5. Number of people: mqtt in node with the topic stat/<Hauptthema>/DETECTION (output Ein String (a String)), function node, KNX node 6/0/2. Content of the function node:

    const s = String(msg.payload).trim();
    const n = Number(s);
    if (s === "" || !Number.isInteger(n) || n < 0) return null;
    msg.payload = Math.min(n, 255);
    return msg;
    
  6. Ambient values: Create another mqtt in node:

    Field (mqtt in) Value
    Topic tele/<Hauptthema>/STATE
    Output Ein analysiertes (parsed) JSON-Objekt (a parsed JSON object)

    Connect it to a function node with four outputs (tab “Setup”, field “Outputs”) and these in order to 6/0/4 (temperature), 6/0/5 (humidity), 6/0/3 (brightness) and 6/0/6 (air pressure):

    const j = msg.payload;
    const zahl = (v, f) => (typeof v === "number" ? { payload: v * f } : null);
    return [zahl(j.temperature, 1), zahl(j.humidity, 1), zahl(j.brightness, 1), zahl(j.pressure, 100)];
    
  7. Availability: mqtt in node with the topic tele/<Hauptthema>/LWT (output Ein String (a String)), function node, KNX node 6/0/8 with datapoint 1.002. Content of the function node:

    const s = String(msg.payload).trim();
    if (s !== "Online" && s !== "Offline") return null;
    msg.payload = (s === "Online");
    return msg;
    
  8. Click Deploy.

In the ETS group monitor, check that on 6/0/1 a telegram “occupied” appears when entering the room and “not occupied” after the timeout. If a restarted visualization should get the value immediately, switch on “React to read requests of group addresses” and “Automatically send node values as a response on the KNX bus” in the KNX node. The ambient values arrive only at the sensor's Publish interval. If Node-RED or the broker fails, the last value remains on the bus without KNX noticing.

Verification status

Tested with Node-RED 5.0.10 and sensor firmware 1.4.2.

Next

Manual

KL MZ presence sensor

Mounting, connecting to Wi-Fi, drawing zones.

Smart home

All systems

An overview of the guides for all twelve systems.

Support

Help and contact

Phone, email and contact form.