Mqtt in output dataformate for dashbaord

Hi Team,

am received MQTT IN values using node red but how do i publish into dashabord using this single TOpic name receiving from MQTTIN

With considerable difficulty.

What is publishing that data? Are you in control of the publishing? If yes, then I would strongly recommend you change it to have individual topics OR all values in one message as JSON

1 Like

Hi Thanks for the information @Steve-Mcl i will try to Send data using Json String from the MQTT publisher and try it to subscribe.

Also, try not to use mixed strings like "Humidity : 63.00" and "O2 : 20.09" as you will have to split them up later. Better formatting your JSON payload something like...

  "temperature": 29.3,
  "humidity": 63.0,
  "o2": 20.09

That way, when you receive the data, you can access each item by name e.g...
msg.payload.temperature and msg.payload.humidity and so on and the values with be of number type.

Then when you use them in the dashboard, you can format them to however you like e.g.

  • Temperature: {{ payload.temperature | number:2 }} ℃ would show Temperature: 29.30 ℃ on the dashboard.
  • Humidity: {{ payload.humidity | number:0 }} % would show Humidity: 63 % on the dashboard.

Also your MQTT topic could perhaps be better. "out" and "topic" don't add much value.

I guess this is an air quality sensor so you could use just "iaq" as the mqtt topic.

But perhaps one day you want more than one iaq sensor, so try "iaq/x" where x = the device location.
So one sensor might use "iaq/kitchen", another "iaq/lounge".

You can subscribe to just one of them with "iaq/kitchen" or all of them with "iaq/#"


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