Problems parsing MQTT data to dashboard

Hi, I am new to Node-Red.
I have a working Mosquitto server.
ESP32 publishes two sensor data that are shown at Node_Red debug flow:

Debug output was activated as follow:
Plain from Mosquitto MQTT:

Converted to Javascript:
{temperatura: object}
{humidade: object}

Javascript then split:
{value: 27}
{value: 67}

***New user can only post two pictures so I transcribed the last two:

Still I do not get data that would be suitable for submission to the dashboard.
My goal is to have two gauges, one for temperatura and one for humidade.

Assistance welcome.

mqtt -> json node (or set the mqtt node to send a json message instead), remove the split node.

output will be something like


connect the 2 gauge nodes to the json/mqtt node and in the value fields use:


Don't forget to take a look at the cookbook

Dear backman2, thanks for your availability to assist.
Only the json node:

Not getting the expected result...
What I am doing wrong?

That is the expected result, even easier to just set the mqtt node output to "a parsed JSON object", then you can remove the json node.

OK, did that, from MQTT (straight to debug as a "parsed JSON object")
Get the same result as the previous picture.
Now, you mean I can submit that to the dashboard as it is?

Remember I have 2 gauges, don't I have to use a split somewhere?

As I indicated above, you can use the values directly in the gauge node.

Also read the documentation how to work with json/messages

I am in the process of trying the gauge now...
I have been reading some of these docs, your indication will sure help as well but as it was not working I decided to get some help on making it work. Once it works it also makes it more easy to see what went wrong.

Just a last one.
Gauge is still in progress but you mean gauge will understand I actually have two variables to plot?

Yes: 2 gauges, 2 different values, 1 mqtt node.
The documentation explains the JSON message part, that is what is coming from the MQTT node.

The gauge node parses this message, thus if there is temperatura in there it will display it else it won't, same applies to the humidity.

OK, I have been to this doc already.
My difficulty is to understand how to, for instance, Mosquitto sends temperatura data and humidade data at different moments.
How do I know the data I am dealing with now is temperatura? How do I test it?
Because if I want to do something else with this value I must know what is the data about.

Supose I want to publish back to Mosquito a, say, LED "on" when temperature is above, say, 30 degrees? You see, that is where I am still struggling.

Well, not only there...
I linket MQTT node straight to Gauge and what I am getting is this:


try setting the gauge like this

Hi, thanks dceejay, it worked for temperatura...
How do I get a separate gauge for humidade?

I mean, perhaps link another gauge at the same source and make it as you said just with humidade?

Great, I did that and it worked. Thanks

Thanks again...

HI again...
It is working perfectly with a gauge with value= {{msg.payload.temperatura.value}} and a separate gauge with value={{msg.payload.humidade.value}} but the debug screen shows an error:
"Type error: cannot read property 'value' of undefined" for both temperatura and humidade gauges.

My current flow is as below:

MQTT node:
Server: Mosquitto
Topic: /devices/esp32devboard/#
Output: auto-detect (string or buffer)
Name: AllTopics

Action: always convert to javascript object
property: payload

Group: myGroup
Label: Temperatura
value format: {{msg.payload.temperatura.value}}

Gauge humidade is changed accordingly.


edit I am incorrect, i will post a test flow.

Apologies, i made quick assumptions, the undefined error comes from the gauge node that doesn't accept other data than the one defined.

With this flow it should work, instead of using a "split", it contains 2 switch nodes that only passes data when either temperature or humidity exists. Replace the inject nodes with the mqtt node


@dceejay I am running NR beta, the has key option works nicely for this example :slight_smile: thanks for the implementation!

Hi, this one worked perfect.
Thank you all for your contributions and effort.

This "has key" would be perfect.
Any information on when it will be available?