How to read data from MQTT message

I’m beginner in this stuff;)
I’m getting this code from mosquitto_sub:


How to read this data to items?? I’m using MQTT 2.4 binding.
I have made Thing with channel
String with mqtt state topic “/panasonic/out” .
I added item:
String pompa_dane { channel="mqtt:topic:2da5c4d0:state" }
What now??

Is there a specific value you want? Or multiple of them? The easiest way is to create a channel for each of the values you need, and apply an “incoming value transformation” in the channel config. Use the JsonPath transform.

1 Like

@pacive Can You give me any example how it should look like??

I have made like this and nothing happens

Have you installed the JsonPath transformation service? I think you have written it correctly, and the expression is valid.

Is the thing marked as online?

yes JsonPath is installed, Thing is marked as online…
mosquitto_sub is still getting data but openhab not.
Other mqtt things is working normally.

If you skip the transform, does the item get updated?

no. It should get all data??? maybe stateTopis is different??

What topic did you use with mosquitto_sub?


Then remove the / at the beginning of the state topic. It’s valid to have a slash in the beginning of a mqtt topic, but not recommended.

1 Like

Yeah Man!!! That was it;)

Great! Does it work with the JsonPath as well now?

YESS!!! :smile:
Thank You so much!

One more little problem;)

Number:Temperature pompa_dane_temp_zewn "Rzeczywista [%.1f °C]" <temperature> { channel="mqtt:topic:2da5c4d0:state" }

What is wrong? It’s not working. Still shows NaN

it is changing channel but not item.

2019-04-19 12:20:28.676 [vent.ItemStateChangedEvent] - mqtt_topic_2da5c4d0_state changed from 25 to 24

That is an Item that’s linked to the channel, that’s been created automatically, I guess you have simple mode enabled?
Anyway, what type is the channel? If you want to use a Number item, then the channel must also be of type Number.