[Solved] Mqtt 2.0 Binding and transformationPattern

I switched today to the new mqtt binding.
Most things works fine.
But one tasmota device with three DS18B20 temperature sensor makes some trouble on ```
transformationPattern.

The error is:

18:24:45.590 [WARN ] [al.generic.ChannelStateTransformation] - Executing the JSONPATH-transformation failed: Invalid path '$.DS18B20-2.Temperature]' in '{"Time":"2019-01-02T18:24:45","DS18B20-1":{"Id":"01161A45A0EE","Temperature":20.9},"DS18B20-2":{"Id":"0216171E56EE","Temperature":22.2},"DS18B20-3":{"Id":"02161742F3EE","Temperature":20.4},"TempUnit":"C"}'
18:24:45.593 [WARN ] [generic.internal.generic.ChannelState] - Incoming payload '{"Time":"2019-01-02T18:24:45","DS18B20-1":{"Id":"01161A45A0EE","Temperature":20.9},"DS18B20-2":{"Id":"0216171E56EE","Temperature":22.2},"DS18B20-3":{"Id":"02161742F3EE","Temperature":20.4},"TempUnit":"C"}' not supported by type 'NumberValue'
18:24:45.594 [WARN ] [al.generic.ChannelStateTransformation] - Executing the JSONPATH-transformation failed: Invalid path '$.DS18B20-3.Temperature]' in '{"Time":"2019-01-02T18:24:45","DS18B20-1":{"Id":"01161A45A0EE","Temperature":20.9},"DS18B20-2":{"Id":"0216171E56EE","Temperature":22.2},"DS18B20-3":{"Id":"02161742F3EE","Temperature":20.4},"TempUnit":"C"}'
18:24:45.595 [WARN ] [generic.internal.generic.ChannelState] - Incoming payload '{"Time":"2019-01-02T18:24:45","DS18B20-1":{"Id":"01161A45A0EE","Temperature":20.9},"DS18B20-2":{"Id":"0216171E56EE","Temperature":22.2},"DS18B20-3":{"Id":"02161742F3EE","Temperature":20.4},"TempUnit":"C"}' not supported by type 'NumberValue'
18:24:45.595 [WARN ] [al.generic.ChannelStateTransformation] - Executing the JSONPATH-transformation failed: Invalid path '$.DS18B20-1.Temperature]' in '{"Time":"2019-01-02T18:24:45","DS18B20-1":{"Id":"01161A45A0EE","Temperature":20.9},"DS18B20-2":{"Id":"0216171E56EE","Temperature":22.2},"DS18B20-3":{"Id":"02161742F3EE","Temperature":20.4},"TempUnit":"C"}'

thing file:

Thing topic underfloorheater “Fußbodenheizung”@ “Erdgeschoss” {
Channels:
Type string : wz_temp “Wohnzimmer Temperatur” [ stateTopic=“tele/groundfloor/SENSOR”, transformationPattern=“JSONPATH:$.DS18B20-1.Temperature]”]
Type number : kt_temp “Küche Temperatur” [ stateTopic=“tele/groundfloor/SENSOR”, transformationPattern=“JSONPATH:$.DS18B20-2.Temperature]”]
Type number : fl_temp “Flur Temperatur” [ stateTopic=“tele/groundfloor/SENSOR”, transformationPattern=“JSONPATH:$.DS18B20-3.Temperature]”]
Type switch : wz_relay “Wohnzimmer Relay” [ stateTopic=“stat/groundfloor/POWER1”, commandTopic=“cmnd/groundfloor/POWER1”]
Type switch : kt_relay “Küche Relay” [ stateTopic=“stat/groundfloor/POWER3”, commandTopic=“cmnd/groundfloor/POWER3”]
Type switch : fl_relay “Flur Relay” [ stateTopic=“stat/groundfloor/POWER4”, commandTopic=“cmnd/groundfloor/POWER4”]
Type number : rssi “WiFi Signal Strength” [ stateTopic=“tele/groundfloor/STATE”, transformationPattern=“JSONPATH:$.Wifi.RSSI”]
}
The json string looks like this:

{"Time":"2019-01-02T18:01:45","DS18B20-1":{"Id":"01161A45A0EE","Temperature":20.8},"DS18B20-2":{"Id":"0216171E56EE","Temperature":22.1},"DS18B20-3":{"Id":"02161742F3EE","Temperature":20.4},"TempUnit":"C"}

Your item looks to have an extra ] that shouldn’t be there.

Change this

Type string : wz_temp “Wohnzimmer Temperatur” [ stateTopic=“tele/groundfloor/SENSOR”, transformationPattern=“JSONPATH:$.DS18B20-1.Temperature]”]

to this.

Type string : wz_temp “Wohnzimmer Temperatur” [ stateTopic=“tele/groundfloor/SENSOR”, transformationPattern=“JSONPATH:$.DS18B20-1.Temperature”]

Will need to do the same for the other items also.

3 Likes

thx, but this was only a copy&paste error in thix thread from me. :frowning:
The syntax in the things file has no extra brackets…

Maybe a silly question but you do have the jsonpath transformation service installed correct?

2 Likes

Hopefully yes.
The installation works before i updated to Build #1486.

This item in the same thing works with transformation:
Type number : rssi "WiFi Signal Strength" [ stateTopic="tele/groundfloor/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]

You were getting the sensor reading before?

If not maybe it has something to do with the -1, -2, -3 at the end of each DS18B20 but I didn’t find anything mentioned on the tasmota wiki.:neutral_face:

1 Like

Yes the reading was fine with the mqtt 1x binding.

What is Build 1486, is that an older M4 snapshot? Sorry I sometimes get lost with all the different build numbers. I would recommend upgrading to M4 stable.

1 Like

i bang my head on the keyboard… :tired_face:
It was another missconfiguration from me.
In this thread Sonoff Tasmota with MQTT Binding 2.4 (using config files) i found how to configure it with item.file and things.file.

1 Like

It’s good you have it working.:+1:

If you would please mark the topic as solved.

Thanks

1 Like