How to filter a value from a mqtt message

Hi I have a question and I want to separate the value of temperature from this MQTT message."{"Time": "2021-11-09T10:25:12", "COUNTER":{"C1":20701}, "DS18B20":{"Id": "01193555EC2D", "Temperature":20.3}, "TempUnit": "C"}" |
Can I filter out the value ?
Thanks in advance

Welcome to the forum @bigluc

When you look at the value in a debug node does it say it is a String? If so then, in the MQTT node Output drop dropdown select Parsed JSON and it will parse that string (which is JSON) and convert it to a javascript object. Then check in the debug node that it shows it as an object with the data in it.

Next have a look at the node red docs page Working with Messages which should get you going with how to access the individual attributes.

What do you want to do with the value?

hello colin
yes its a string.
I´ll like to get a value to show the temparature on a website

What website?

Is it now showing as a javascript object?

so the goal is to extract the value from the string to output it to a website in the future. But before that I want to output the values one by one in a debug to see how well this works, because this is only the beginning of the few difficulties has :slight_smile:

So what are you getting in the debug now?

Set the output of your MQTT In node to "A parsed JSON object".
Set your Debug node to show msg.payload.DS18B20.Temperature.

The Debug output should be just the temperature value.

@bigluc is (or should be) doing that bit already.

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