How to have different properties of sensors under each sensor id in mqqt message in node red

how to re- arrange the details of each sensor under its sensor_id in a function node (as given below) after a buffer parser to send it to a mqqt broker.

	"Time": "2021-09-14T08:08:07.434Z",
	 "Location_id" = 1
    "Circuit_Id"= 1,
		"C1Ia": 0.5,
                "C1Ib": 0.6,
                "C1Ic": 0.7,
    "Circuit_Id"= 2,
		"C2Ia": 0.7,
                "C2Ib": 0.6,
                "C2Ic": 0.8,	


You need to walk through the object and output each property with a new topic.

Your exported flow is invalid....

... please export it again.

Additionally, as we do not have your modbus device, please provide sample data by...

  • add a debug node (set to show FULL MESSAGE) to the output of the ModBus node
  • Wait for data to arrive
  • Copy the messages value by clicking the "copy value" button that appears under your mouse when you hover over the message in the RH sidebar - example...

Lastly, your description is not 100% clear. Are you attempting to make individual MQTT messages like this...

topic payload
Circuit_Id/1/C1Ia 0.5
Circuit_Id/1/C1Ib 0.6
Circuit_Id/1/C1Ic 0.7
Circuit_Id/2/C2Ia 0.7
Circuit_Id/2/C2Ib 0.6
Circuit_Id/2/C2Ic 0.8

If not, please be clear in your requirement.

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