Contents
The Loxone Miniserver integrates the sensor over HTTP. A Virtual HTTP Input polls the sensor on your home network at regular intervals and reads fill level, fill height, liters and temperature from the response, and the alarm with one small extra step. No additional device is needed. The method described works for every Miniserver, including Gen. 1. If the sensor runs in power saving mode, use MQTT instead: from Config 15.3 with the Miniserver's own MQTT (not Gen. 1) or via a LoxBerry (see Optional).
In all examples, <IP> stands for the IP address of the sensor and <Hauptthema> for whatever is entered on the sensor under Connections → Main topic. Replace both with your own values.
Requirements
- Miniserver (Gen. 1, Gen. 2, Compact or Go) and Loxone Config
- Sensor with firmware 4.2.8 on the same network as the Miniserver
- fixed IP address for the sensor (permanently assign the address in the router)
- Power saving mode on the sensor off (otherwise see Limitations)
Setting up the sensor
For the HTTP method, nothing needs to be set on the sensor. You can check in the browser whether it responds: http://<IP>/measurements returns a line like
{"strength": 1200, "level": 75.0, "filling": 2250.0, "rel_level": 50, "out_of_range": false, "temperature": 12.5, "distance": 105.0, "problem": false, "alert": "-"}
The order of the fields is not fixed. The patterns below can handle that. What the fields mean is explained in the user manual.
Setup
-
In Loxone Config, select Virtual Inputs in the Periphery tree and add a Virtual HTTP Input. Properties:
Property Value URL http://<IP>/measurementsPolling cycle 60(seconds; the smallest permitted value is10)Timeout 4000(ms; permitted10…8000)Number of allowed timeouts 5If authentication is switched on at the sensor under System, the URL is
http://<Login>:<Passwort>@<IP>/measurements. -
Select the HTTP input and add one Virtual HTTP Input Command for each value you want. In its Command Recognition property, enter the pattern from the table (exactly as shown, including the space after the colon):
Value Command Recognition Result Fill level in % \i"rel_level": \i\v0…100Fill height in cm \i"level": \i\vz. B. 75Contents in liters \i"filling": \i\vz. B. 2250Distance in cm \i"distance": \i\vz. B. 105Temperature in °C \i"temperature": \i\vz. B. 12.5\i…\ijumps to the position after the given text,\vreads the number found there. -
Drag the commands onto a program page, give them a unit (e.g.
<v> %) and 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.
- In the live view, the “Fill level” command must show the same value as the sensor's main page (after one polling cycle at the latest).
Optional
Fault and alarm (no numbers)
problem and out_of_range are true/false, alert is "-", "MIN" or "MAX". \v finds no number in them. With \1, Loxone instead returns the character code of the next character:
| Value | Command Recognition | Result |
|---|---|---|
| Transducer delivers nothing | \i"problem": \i\1 |
116 = yes (t), 102 = no (f) |
| Measured value outside the tank | \i"out_of_range": \i\1 |
116 = yes, 102 = no |
| Alarm | \i"alert": "\i\s1\1 |
34 = no alarm, 73 = MIN, 65 = MAX |
For the alarm, \s1 skips the first character and reads the second (", I or A), because MIN and MAX start the same way. Follow it with a comparison block that checks for the respective value. Simpler and just as good: derive the alarm in Loxone itself from the fill level (threshold on “Fill level in %”).
Loxone's own MQTT (from Config 15.3, not Miniserver Gen. 1)
The Miniserver acts only as a client here. A broker on the network (e.g. Mosquitto on a NAS, or LoxBerry) is therefore required, to which the sensor also sends (settings: see the user manual).
-
Select Network Periphery → Add network device → MQTT. Properties:
Property Value Broker address IP address of the broker Broker port 1883Client ID free, but different from the sensor's Username / password only if the broker requires them -
Select the MQTT object and add one Subscription for each value:
Property Value Topic stat/<Hauptthema>/REL_LEVEL(likewiseLEVEL,FILLING,DISTANCE) -
A subscription delivers text. Follow it with the Command Recognition block (input
T, outputLv):Property Value Command Recognition \vThe temperature is only available in the JSON: subscription to
tele/<Hauptthema>/STATE, Command Recognition\i"temperature": \i\v.
At most 16 subscriptions per Miniserver; it evaluates changes at most every 2 seconds. For an immediate report from the sensor, add a Publish object with topic cmnd/<Hauptthema>/UPDATE (retain off).
LoxBerry with MQTT Gateway
Worthwhile if a LoxBerry is already running (the gateway including the broker has been built in since LoxBerry 3.0) or if the Miniserver Gen. 1 is to get MQTT.
-
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.
-
On the Subscriptions tab, tick the topics you want, e.g.
stat/<Hauptthema>/REL_LEVEL. Fortele/<Hauptthema>/STATE, switch on the JSON option and tick only the fields you need. -
On the Incoming Overview tab, copy the names (do not type them) and create a Virtual Input in Loxone Config for each value, with exactly this name. The names follow this pattern:
Topic on the sensor Name of the Virtual Input (HTTP) stat/<Hauptthema>/REL_LEVELstat_<Hauptthema>_REL_LEVELtele/<Hauptthema>/STATE, fieldrel_leveltele_<Hauptthema>_STATE_rel_leveltele/<Hauptthema>/STATE, fieldtemperaturetele_<Hauptthema>_STATE_temperature -
Return path (e.g. requesting an immediate report): add a Virtual Output and below it a Virtual Output Command:
Property Value Address (on the output) /dev/udp/<IP des LoxBerry>/11884Command for ON (on the command) publish cmnd/<Hauptthema>/UPDATE 1
For the alarm, on the Gateway tab under Text to value conversions, enter MIN=1 and MAX=2. The gateway only transmits changes.
Limitations
- Power saving mode: Over HTTP, the sensor only responds while it is awake. The query then mostly goes nowhere. In power saving mode, use one of the two MQTT methods. The broker keeps the last value.
- The HTTP method is read-only; the sensor cannot be configured through it.
- If the sensor fails, the last value stays at the HTTP input. The Miniserver reports the failure after the configured number of timeouts.
- The IP address is fixed in the URL. If it changes, nothing arrives any more.
- With authentication, the password appears in plain text in the URL.
Verification status
Guide created from Loxone's documentation.