Extracting Values from JSON with matching attribute name

platform is used and what version: RasPi with openHAB version: 2.5.7


i have a TASMOTA device with 4 DS18B20 temperature sensors connected. Each sensor has a worldwide unique Id. TASMOTA scans the sensors, numbers them with DS18B20-n and builds dynamicaly this JSON:

{ "Time":"2020-08-03T19:43:02",

I defined a thing with the following channels to extract the Values of these sensors:

Thing mqtt:topic:Hzg "Heizung" (mqtt:broker:myMqttBroker)  {
Type string : Ruecklauf_T  "Temperatur RĂĽcklauf"   [ stateTopic="t31/tele/SENSOR", transformationPattern="JSONPATH:$.DS18B20-1.Temperature" ]
Type string : Heizkeller_T "Temperatur Heizkeller" [ stateTopic="t31/tele/SENSOR", transformationPattern="JSONPATH:$.DS18B20-2.Temperature" ]
Type string : Aussen_T     "Temperatur Aussen"     [ stateTopic="t31/tele/SENSOR", transformationPattern="JSONPATH:$.DS18B20-3.Temperature" ]
Type string : Vorlauf_T    "Temperatur Vorlauf"    [ stateTopic="t31/tele/SENSOR", transformationPattern="JSONPATH:$.DS18B20-4.Temperature" ]

At a first view, this looks good and is working. But it happens in some rare situations, that after rebooting, TASMOA does not see all sensors, but e.g. only 3 of them. So the numbering of the sensors gets cluttered and channel assignment is wrong now. The same happens, if i add more Sensors. Then they are sorted in alphabetically and clutter the rest of the entries.

So my question:
Is it possible to filter the entries with the help of their Id? Because the Id is always assigned to the physical Sensor and can not change.
For example i want to read Ruecklauf_T always from the Sensor with Id “021561B10FFF”

Has anyone an idea how to solve this in openHAB2 ?


Pinging @rossko57 because he has worked some magic very recently on almost exactly the same scenario…

EDIT: Found it!!

1 Like

This addresses exactly the same problem and the solution is perfect for my. I didn’t see this thread while searching.

Thanks a lot @hafniumzinc and @rossko57