# Several MQTT to one InfluxDB 2.0 bucket

**URL:** <https://discourse.nodered.org/t/several-mqtt-to-one-influxdb-2-0-bucket/63362>\
**Category:** General\
**Tags:** mqtt\
**Created:** [1 June 2022 13:41 UTC](https://discourse.nodered.org/t/several-mqtt-to-one-influxdb-2-0-bucket/63362 "2022-06-01T13:41:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![airvb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/airvb/32/62489_2.png) [@airvb](https://discourse.nodered.org/u/airvb)\
**Post date:** [1 June 2022 13:41 UTC](https://discourse.nodered.org/t/several-mqtt-to-one-influxdb-2-0-bucket/63362/1 "2022-06-01T13:41:15Z")

</div>

Hello ,  
I'm very newbie so apologize if the question seems weird !

i have 1 mqtt provider with 3 differents topics  
I subscribe at each like this xxx/#  
The payload for each sensors is like this :

```auto
chaudiere_1/T.EXTERNE/H.ext : msg.payload : number
50.7

```

I made change like this :  
 ![ksnip_20220601-145423](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/1/4139f9f9792a33838876d5182683e9ebec7dde68.png)

The msg.payload function :

```auto
[
    {
        "value": msg.payload
        },{
        "capteur": msg.topic
    }
]

```

Example of data send to influxdb2.0:

```auto
{
  "topic": "chaudiere_1/T.INTERNE/H.interne",
  "payload": [
    {
      "value": 37.8
    },
    {
      "capteur": "chaudiere_1/T.INTERNE/H.interne"
    }
  ],
  "_msgid": "d56418462e3d2b1b",
  "measurement": "chaudiere_1/T.INTERNE/H.interne"
}

```

And all datas go to influxdb2.0 bucket  
As you can see below all data are under the same measurement.

 ![ksnip_20220601-152721](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/3/f34aca8d6e10a4a4244223373fc3a8cdcae3e0da.png)

How can i send data to have a different measurement for each subscribe topic ?

Thanks !

---

<div class="post-metadata">

**Author:** ![struland](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/struland/32/58587_2.png) [@struland](https://discourse.nodered.org/u/struland)\
**Post date:** [2 June 2022 06:13 UTC](https://discourse.nodered.org/t/several-mqtt-to-one-influxdb-2-0-bucket/63362/2 "2022-06-02T06:13:27Z")

</div>

It is a little hard for me to fully understand your question. But here is a suggestion:  
Try to group your measurements by physical unit. And then use tags for the different devices (e.g. a certain maschine or computer system ) of the measurement.  
If an origin has also different sensors

```auto
{"measurement":"temperatures",
"tags":{
   "device": "T.INTERNE",
   "base": "claudiere_1"
},
"fields":{
   "chaude" : 12.3,
   "froid" : -10.3
   }
}

```

In this example the device "T.INTERNE" has 2 temperature sensors named "chaude" and "froid".

```auto

```

---

<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:** [1 August 2022 06:13 UTC](https://discourse.nodered.org/t/several-mqtt-to-one-influxdb-2-0-bucket/63362/3 "2022-08-01T06:13:58Z")

</div>

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