Contents
Node-RED integrates the sensor via MQTT: the built-in MQTT nodes read the sensor's messages from your broker. This guide contains a ready-made flow that you import once by hand. With the add-on package “Dashboard 2.0”, it shows fill level, contents, fill height, temperature, alarm, fault and availability, and there you set the alarm limit “Minimum” and the alarm at minimum on the sensor.
In this guide, <Hauptthema> stands for the value entered on the sensor under
Connections → Main topic (for example zisterne). Replace it everywhere with your own value, without the angle brackets.
Prerequisites
- Node-RED is already running. Tested with Node-RED 5.0.10. Only these built-in nodes are used:
mqtt in,mqtt out,changeandswitch. - For the display, the package
@flowfuse/node-red-dashboard(“Dashboard 2.0”), tested with 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.
- Sensor with firmware 4.2.8 or newer.
Setting up the sensor
In the sensor's web interface, under Connections select the connection type MQTT Broker, enter the server and port of your broker and assign a main topic. The switch Home Assistant is not needed for Node-RED. All fields and all 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 “Füllstand”) are German.
-
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-dashboardOn the matching result, click Install to add it.
-
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 HAUPTTHEMAYour main topic, e.g. zisterneThere are 11 occurrences.
-
Import the flow: Menu → Import, paste the changed text into the field and click Import to finish. A new tab “Füllstandsensor” appears.
-
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 1883If 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.
-
At the top right, click Deploy to apply the changes.
Quick test
- After a few seconds, the text connected appears under the MQTT nodes.
- Open the dashboard:
http://<Adresse von Node-RED>:1880/dashboard/fuellstandor, in the right sidebar, Dashboard 2.0 → Open Dashboard in the browser. - Fill level, contents and fill height appear immediately because the broker keeps the last value. Compare the values with the sensor's web interface.
If everything stays empty although “connected” is shown, the main topic is almost always wrong. Mind upper and lower case.
Optional
Setting values from the dashboard. The flow contains a slider for the alarm limit “Minimum” and a switch for the alarm at minimum. Other values work the same way with an mqtt out node:
Field in the mqtt out node |
Value |
|---|---|
| Topic |
cmnd/<Hauptthema>/MAXI (more names in the user manual) |
| Retain |
falsch (false in the English interface) |
A whole number without a unit is sent (e.g. 80), and for the alarm switches the text ON or OFF. 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.
Reusing the alarm. The sensor reports, under stat/<Hauptthema>/ALERT
MIN or MAX and, when there is no alarm, an empty message. The node “leer = kein Alarm” (empty = no alarm) turns this into the text kein Alarm. You can attach a notification to its output. After a restart of Node-RED, the state “kein Alarm” (no alarm) comes from the status message tele/<Hauptthema>/STATE, because the broker does not retain an empty message.
Availability. tele/<Hauptthema>/LWT returns Online or Offline
and appears in the dashboard as “Verbindung” (connection). Offline is set by the broker shortly after the sensor has failed (keepalive 15 seconds).
Fault. stat/<Hauptthema>/PROBLEM returns the text True or False
(capitalized first letter). The node “True/False in Text” translates this into “Störung” (fault) and “in Ordnung” (OK).
Without MQTT. An http request node for
http://<IP des Sensors>/measurements with the return set to “a parsed JSON object” delivers the same measured values without a broker. However, nothing can be set this way.
Limitations
- The temperature is only available in the status message
tele/<Hauptthema>/STATE. It therefore changes only at the pace of the send interval (factory value 5 minutes). - If the sensor temporarily delivers no measured value, the fill level display keeps the last value. Whether something is wrong is shown by “Messwertgeber” (sensor element).
- In power saving mode, “Verbindung” (connection) stays at
Online, even while the sensor is asleep. - The flow includes its own dashboard interface at
/dashboardand, if you already run a Dashboard 2.0, you assign the page “Füllstand” (fill level) to your existing interface afterwards and delete the included one. - Encryption (TLS) and login to the broker are set on the broker node.
Verification status
Tested with Node-RED 5.0.10, Dashboard 2.0 and sensor firmware 4.2.8.
Flow
Before importing, replace HAUPTTHEMA (step 2).
[
{"id":"ls_tab","type":"tab","label":"Füllstandsensor","disabled":false,"info":""},
{"id":"ls_broker","type":"mqtt-broker","name":"Broker Füllstandsensor","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":"ls_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":"ls_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":"ls_page","type":"ui-page","name":"Füllstand","ui":"ls_base","path":"/fuellstand","icon":"water","layout":"grid","theme":"ls_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":"ls_grp","type":"ui-group","name":"Messwerte","page":"ls_page","width":6,"height":1,"order":1,"showTitle":true,"className":"","visible":"true","disabled":"false","groupType":"default","keepLoaded":false,"tab":""},
{"id":"ls_grp_set","type":"ui-group","name":"Einstellen","page":"ls_page","width":6,"height":1,"order":2,"showTitle":true,"className":"","visible":"true","disabled":"false","groupType":"default","keepLoaded":false,"tab":""},
{"id":"ls_in_rel","type":"mqtt in","z":"ls_tab","name":"","topic":"stat/HAUPTTHEMA/REL_LEVEL","qos":"0","datatype":"auto-detect","broker":"ls_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":80,"wires":[["ls_sw_num"]]},
{"id":"ls_sw_num","type":"switch","z":"ls_tab","name":"nur Zahlen","property":"payload","propertyType":"msg","rules":[{"t":"istype","v":"number","vt":"number"}],"checkall":"true","repair":false,"outputs":1,"x":480,"y":80,"wires":[["ls_gauge","ls_chart"]]},
{"id":"ls_gauge","type":"ui-gauge","z":"ls_tab","name":"Füllstand","group":"ls_grp","order":1,"value":"payload","valueType":"msg","width":3,"height":4,"gtype":"gauge-tank","gstyle":"needle","title":"Füllstand","alwaysShowTitle":false,"floatingTitlePosition":"top-left","units":"%","icon":"","prefix":"","suffix":"","segments":[{"from":"0","color":"#A8F5FF"},{"from":"15","color":"#55DBEC"},{"from":"35","color":"#53B4FD"},{"from":"50","color":"#2397D1"}],"min":0,"max":100,"sizeThickness":16,"sizeGap":4,"sizeKeyThickness":8,"styleRounded":true,"styleGlow":false,"className":"","x":760,"y":60,"wires":[]},
{"id":"ls_chart","type":"ui-chart","z":"ls_tab","group":"ls_grp","name":"Verlauf","label":"Füllstand in %","order":8,"chartType":"line","category":"Füllstand","categoryType":"str","xAxisLabel":"","xAxisProperty":"","xAxisPropertyType":"timestamp","xAxisType":"time","xAxisFormat":"","xAxisFormatType":"auto","xmin":"","xmax":"","yAxisLabel":"","yAxisProperty":"payload","yAxisPropertyType":"msg","ymin":"0","ymax":"100","bins":10,"action":"append","stackSeries":false,"pointShape":"circle","pointRadius":4,"showLegend":false,"removeOlder":1,"removeOlderUnit":"604800","removeOlderPoints":"","colors":["#0095FF","#FF0000","#FF7F0E","#2CA02C","#A347E1","#D62728","#FF9896","#9467BD","#C5B0D5"],"textColor":["#666666"],"textColorDefault":true,"gridColor":["#e5e5e5"],"gridColorDefault":true,"width":6,"height":5,"className":"","interpolation":"linear","x":760,"y":100,"wires":[[]]},
{"id":"ls_in_fill","type":"mqtt in","z":"ls_tab","name":"","topic":"stat/HAUPTTHEMA/FILLING","qos":"0","datatype":"auto-detect","broker":"ls_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":160,"wires":[["ls_t_fill"]]},
{"id":"ls_t_fill","type":"ui-text","z":"ls_tab","group":"ls_grp","order":2,"width":0,"height":0,"name":"Inhalt","label":"Inhalt","format":"{{msg.payload}} l","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":false,"className":"","value":"payload","valueType":"msg","x":760,"y":160,"wires":[]},
{"id":"ls_in_level","type":"mqtt in","z":"ls_tab","name":"","topic":"stat/HAUPTTHEMA/LEVEL","qos":"0","datatype":"auto-detect","broker":"ls_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":220,"wires":[["ls_t_level"]]},
{"id":"ls_t_level","type":"ui-text","z":"ls_tab","group":"ls_grp","order":3,"width":0,"height":0,"name":"Füllhöhe","label":"Füllhöhe","format":"{{msg.payload}} cm","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":false,"className":"","value":"payload","valueType":"msg","x":760,"y":220,"wires":[]},
{"id":"ls_in_state","type":"mqtt in","z":"ls_tab","name":"","topic":"tele/HAUPTTHEMA/STATE","qos":"0","datatype":"auto-detect","broker":"ls_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":300,"wires":[["ls_c_temp","ls_c_alert2"]]},
{"id":"ls_c_temp","type":"change","z":"ls_tab","name":"Temperatur aus JSON","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.temperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":280,"wires":[["ls_t_temp"]]},
{"id":"ls_t_temp","type":"ui-text","z":"ls_tab","group":"ls_grp","order":4,"width":0,"height":0,"name":"Temperatur","label":"Temperatur","format":"{{msg.payload}} °C","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":false,"className":"","value":"payload","valueType":"msg","x":760,"y":280,"wires":[]},
{"id":"ls_c_alert2","type":"change","z":"ls_tab","name":"Alarm aus JSON","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.alert ? payload.alert : \"kein Alarm\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":340,"wires":[["ls_t_alert"]]},
{"id":"ls_in_alert","type":"mqtt in","z":"ls_tab","name":"","topic":"stat/HAUPTTHEMA/ALERT","qos":"0","datatype":"auto-detect","broker":"ls_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":400,"wires":[["ls_c_alert"]]},
{"id":"ls_c_alert","type":"change","z":"ls_tab","name":"leer = kein Alarm","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload in [\"MIN\", \"MAX\"] ? payload : \"kein Alarm\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":400,"wires":[["ls_t_alert"]]},
{"id":"ls_t_alert","type":"ui-text","z":"ls_tab","group":"ls_grp","order":5,"width":0,"height":0,"name":"Alarm","label":"Alarm","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":false,"className":"","value":"payload","valueType":"msg","x":760,"y":370,"wires":[]},
{"id":"ls_in_problem","type":"mqtt in","z":"ls_tab","name":"","topic":"stat/HAUPTTHEMA/PROBLEM","qos":"0","datatype":"auto-detect","broker":"ls_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":460,"wires":[["ls_c_problem"]]},
{"id":"ls_c_problem","type":"change","z":"ls_tab","name":"True/False in Text","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload = \"True\" ? \"Störung\" : \"in Ordnung\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":460,"wires":[["ls_t_problem"]]},
{"id":"ls_t_problem","type":"ui-text","z":"ls_tab","group":"ls_grp","order":6,"width":0,"height":0,"name":"Messwertgeber","label":"Messwertgeber","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":false,"className":"","value":"payload","valueType":"msg","x":760,"y":460,"wires":[]},
{"id":"ls_in_lwt","type":"mqtt in","z":"ls_tab","name":"","topic":"tele/HAUPTTHEMA/LWT","qos":"0","datatype":"auto-detect","broker":"ls_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":520,"wires":[["ls_t_lwt"]]},
{"id":"ls_t_lwt","type":"ui-text","z":"ls_tab","group":"ls_grp","order":7,"width":0,"height":0,"name":"Verbindung","label":"Verbindung","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":false,"className":"","value":"payload","valueType":"msg","x":760,"y":520,"wires":[]},
{"id":"ls_in_mini","type":"mqtt in","z":"ls_tab","name":"","topic":"stat/HAUPTTHEMA/MINI","qos":"0","datatype":"auto-detect","broker":"ls_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":620,"wires":[["ls_slider"]]},
{"id":"ls_slider","type":"ui-slider","z":"ls_tab","group":"ls_grp_set","name":"Minimum","label":"Alarm Minimum (%)","tooltip":"","order":1,"width":0,"height":0,"passthru":false,"outs":"end","topic":"topic","topicType":"msg","thumbLabel":"always","showTicks":"false","min":0,"max":100,"step":1,"className":"","iconPrepend":"","iconAppend":"","color":"","colorTrack":"","colorThumb":"","showTextField":true,"x":480,"y":620,"wires":[["ls_out_mini"]]},
{"id":"ls_out_mini","type":"mqtt out","z":"ls_tab","name":"","topic":"cmnd/HAUPTTHEMA/MINI","qos":"0","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"ls_broker","x":760,"y":620,"wires":[]},
{"id":"ls_in_amin","type":"mqtt in","z":"ls_tab","name":"","topic":"stat/HAUPTTHEMA/ALERT_MIN","qos":"0","datatype":"auto-detect","broker":"ls_broker","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":700,"wires":[["ls_c_amin"]]},
{"id":"ls_c_amin","type":"change","z":"ls_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":400,"y":700,"wires":[["ls_switch"]]},
{"id":"ls_switch","type":"ui-switch","z":"ls_tab","name":"Alarm MIN","label":"Alarm bei Minimum","group":"ls_grp_set","order":2,"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":600,"y":700,"wires":[["ls_out_amin"]]},
{"id":"ls_out_amin","type":"mqtt out","z":"ls_tab","name":"","topic":"cmnd/HAUPTTHEMA/ALERT_MIN","qos":"0","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"ls_broker","x":800,"y":700,"wires":[]}
]
Appendix: Writing values to the KNX bus
With the package node-red-contrib-knx-ultimate (via Manage palette, Node-RED 3.1.1 or newer on Node.js 20.18 or newer), Node-RED writes the sensor values to group addresses. Group addresses and datapoint types are listed in the KNX integration guide. The addresses below are the examples from there.
-
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 3671Connection protocol Auto(interface: Tunnel UDP, router: Multicast UDP)KNX Physical Address a free physical address on the line, e.g. 1.1.250 -
For each row of the table in the KNX integration guide, create a KNX Device node:
Field Value Group address e.g. 5/0/1Datapoint e.g. 5.001Send payload to the KNX BUS only on change (RBE filter) enabled -
For the fill level, create an mqtt in node and connect it via a function node to the KNX node
5/0/1:Field (mqtt in) Value Server IP address of the broker, port 1883Topic stat/<Hauptthema>/REL_LEVELOutput Ein StringContent of the function node (does not let empty messages onto the bus):
const s = String(msg.payload).trim(); if (s === "" || isNaN(Number(s))) return null; msg.payload = Number(s); return msg; -
Click Deploy.
The remaining values follow the same pattern:
| Value | Topic (mqtt in) | Output (mqtt in) | function node |
|---|---|---|---|
| Contents in m³ | stat/<Hauptthema>/FILLING |
Ein String |
as above, last assignment msg.payload = Number(s) / 1000;
|
| Temperature | tele/<Hauptthema>/STATE |
Ein analysiertes (parsed) JSON-Objekt |
see below |
| Alarm MIN / MAX | stat/<Hauptthema>/ALERT |
Ein String |
see below, two outputs |
Temperature (only in the JSON):
const t = msg.payload.temperature;
if (typeof t !== "number") return null;
msg.payload = t;
return msg;
Alarm (function node with two outputs: the first goes to 5/0/4, the second to 5/0/5; with no alarm the message is empty, and both become false):
const a = String(msg.payload);
return [{ payload: a === "MIN" }, { payload: a === "MAX" }];
In the ETS group monitor, check that on 5/0/1 a telegram appears with the same percentage value as on the sensor's main page. 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.