MQTT 2.4 Binding: Number as state topic and incoming value transformation is not working

Hi everybody,
after some evenings spending my time in reading posts and try some trial and error I dont know what to do.
I have openhab 2.4 running on my raspberry.
The connection via MQTT Mosquitto from the MQTT 2.4 binding and the ESP8266 (Tasmota firmware) is working.
I can see the messages in MQTT.fx.
Unfortunately if I try to show the distance of my HC-SR04 (connected on the ESP8266) I see only “NaN”.
Acc. to MQTT.fx the state topic from the ESP is:

The Thing in openhab has a chanel with following configuaration:
MQTT state topic: tele/GarageESP/SENSOR
Incoming value transformation: “JSONPATH:$.SR04.Distance”
The linked Item is default.
transformation-jsonpath - 2.4.0 is also installed.

I hope someone can help me.

Best regards

Errors in the log?

You may want to upgrade as OH 2.4 is over a year old.


this is the log file:
2020-05-08 17:38:29.344 [WARN ] [l.generic.ChannelStateTransformation] - Transformation service “JSONPATH for pattern $.SR04.Distance” not found!

2020-05-08 17:38:29.348 [WARN ] [eneric.internal.generic.ChannelState] - Incoming payload ‘{“Time”:“2020-05-08T16:38:29”,“SR04”:{“Distance”:28.947}}’ not supported by type ‘NumberValue’

You do not have the JSONPATH Transformation installed.

If I go to Add-ons and Transformations I can see that the transformation-jsonpath - 2.4.0 is installed. Its also blue on the icon.

Trying to test the JSONPATH in various JSON testers indicate that {“Time”:“2020-05-08T16:38:29”,“SR04”:{“Distance”:28.947}} is not valid JSON. I’m not good enough at JSON to say why it’s invalid but there is something wrong with it.

The message is clear and specific. The JSONPATH transformation is not available.
I think I’d uninstall/reinstall to see if something is stuck in its throat.

Man oh man. Manchmal soll’s halt so sein.
Danke für die Denkanstöße, haben mir geholfen meinen blöden Fehler zu finden.
Habe die die Hochkommas mitgeschrieben “JSONPATH:$.SR04.Distance”, wenn ich es so schreibe gehts JSONPATH:$.SR04.Distance
Vielen Dank und bestimmt demnächst.

Error message was quite right. Even I didn’t read it literally enough, the “JSONPATH:$.SR04.Distance” persistence service wasn’t installed at all :crazy_face: