Extract value from MQTT message

I need some help extracting one value (as float or integer) from an MQTT message. This is the relevant part of the MQTT message:

{"BatV":3.041,"Bat_status":3,"Exti_pin_level":"Low","Exti_status":"False","Hum_SHT":71.6,"No_connect":"Sensor no connection","TempC_SHT":13.86 ,"Work_mode":"Interrupt Sensor send"}

Only the value "TempC_SHT" is needed and I think I should use the change node but unfortunately I can't. Can someone tell me how to set up the node?

What is the output of the mqtt node is it a string or object, what settings did you set output to in the mqtt node.

If it is an object
the value would be at msg.payload.TempC_SHT
you can use as is or if you want to move it to msg.payload then
set the change node to
set msg. payload
to msg. payload.TempC_SHT

Thanks for helping!

Not sure if it is a string, this is the debug info I receive winthin NR so it looks like an object:

payload

Is this helpfull? My first try to set the change node resulted in "undefined".

There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi

From your image the object is in decoded_payload not payload. That may be in another property also, but your image does not show enough info to know for sure. Normally the mqtt node outputs on payload, so you must have other nodes in between it and the debug that have moved the payload.

Use @zenofmud post to get the exact property path.

With your help it was solved, thanks E1cid and zenofmud!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.