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

**URL:** <https://discourse.nodered.org/t/how-to-have-different-properties-of-sensors-under-each-sensor-id-in-mqqt-message-in-node-red/51408>\
**Category:** General\
**Created:** [22 September 2021 18:44 UTC](https://discourse.nodered.org/t/how-to-have-different-properties-of-sensors-under-each-sensor-id-in-mqqt-message-in-node-red/51408 "2021-09-22T18:44:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Energycharges](https://avatars.discourse-cdn.com/v4/letter/e/e47c2d/32.png) [@Energycharges](https://discourse.nodered.org/u/Energycharges)\
**Post date:** [22 September 2021 18:44 UTC](https://discourse.nodered.org/t/how-to-have-different-properties-of-sensors-under-each-sensor-id-in-mqqt-message-in-node-red/51408/1 "2021-09-22T18:44:43Z")

</div>

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.

```auto
{
	"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,	
       }			
   }
}   
}

```

 ![11234](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/3/436fb058e8eb7874831ef82dafeca97ea25d8610.jpeg)

```auto
[{"id":"8c888c45.ce124","type":"delay","z":"f2d0d390.46fca","name":"energydelay","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"50","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":620,"y":620,"wires":[["978b0e29.3ca7c"]]},{"id":"a009d9ff.583bf8","type":"q-gate","z":"f2d0d390.46fca","name":"","controlTopic":"control","defaultState":"queueing","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","queueCmd":"queue","defaultCmd":"default","triggerCmd":"trigger","flushCmd":"flush","resetCmd":"reset","peekCmd":"peek","dropCmd":"drop","statusCmd":"status","maxQueueLength":"1000","keepNewest":false,"qToggle":false,"persist":false,"x":490,"y":620,"wires":[["8c888c45.ce124"]]},{…

```

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [22 September 2021 19:57 UTC](https://discourse.nodered.org/t/how-to-have-different-properties-of-sensors-under-each-sensor-id-in-mqqt-message-in-node-red/51408/2 "2021-09-22T19:57:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 September 2021 21:09 UTC](https://discourse.nodered.org/t/how-to-have-different-properties-of-sensors-under-each-sensor-id-in-mqqt-message-in-node-red/51408/3 "2021-09-22T21:09:15Z")

</div>

Your exported flow is invalid....

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/9/494227a1ada82a94ea41ce8e0091533207826961.png)  
... **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...  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/a/ba184bef6e75111e15f36bff72932d9025f6ae6a.png)

  

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 November 2021 21:09 UTC](https://discourse.nodered.org/t/how-to-have-different-properties-of-sensors-under-each-sensor-id-in-mqqt-message-in-node-red/51408/4 "2021-11-21T21:09:42Z")

</div>

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