# How to send data from two sensor at the same time using MQTT

**URL:** <https://discourse.nodered.org/t/how-to-send-data-from-two-sensor-at-the-same-time-using-mqtt/60097>\
**Category:** General\
**Created:** [20 March 2022 03:10 UTC](https://discourse.nodered.org/t/how-to-send-data-from-two-sensor-at-the-same-time-using-mqtt/60097 "2022-03-20T03:10:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shahrilmajid](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@shahrilmajid](https://discourse.nodered.org/u/shahrilmajid)\
**Post date:** [20 March 2022 03:10 UTC](https://discourse.nodered.org/t/how-to-send-data-from-two-sensor-at-the-same-time-using-mqtt/60097/1 "2022-03-20T03:10:58Z")

</div>

hi, I tried to send data from two sensors, but it seems that only one received data at the server. Here is my node, how to make it able to receive data at the same time from both sensors.

 ![Capture](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/1/2119063ff7a704ee2d28f57dc64cccbf9908965b.jpeg)  
 ![Capture1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/a/9a11241ca499112af50b5c3001823936ed6177a0.jpeg)

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [20 March 2022 04:24 UTC](https://discourse.nodered.org/t/how-to-send-data-from-two-sensor-at-the-same-time-using-mqtt/60097/2 "2022-03-20T04:24:47Z")

</div>

For me it looks that message came from both mqtt.-in Nodes but with the same topic.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/6/36e9231e9d83741c3e05b0de198570f13bbb207a.jpeg)

---

<div class="post-metadata">

**Author:** ![shahrilmajid](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@shahrilmajid](https://discourse.nodered.org/u/shahrilmajid)\
**Post date:** [20 March 2022 04:47 UTC](https://discourse.nodered.org/t/how-to-send-data-from-two-sensor-at-the-same-time-using-mqtt/60097/3 "2022-03-20T04:47:52Z")

</div>

When I reset sensor 1, sensor 1 send data and sensor 2 not sending. when I reset sensor 2, sensor 2 will send data and sensor 1 will not send data. I want all the nodes to work at the same time.

Now I spilt the flow, and it remains the same,

 ![Capture](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/b/4b0c6b4d6136836c3d2dbc0a48b7a0f7a54f8e83.jpeg)  
only I sensor transmits data.

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [20 March 2022 06:46 UTC](https://discourse.nodered.org/t/how-to-send-data-from-two-sensor-at-the-same-time-using-mqtt/60097/4 "2022-03-20T06:46:54Z")

</div>

> [@shahrilmajid](#):
>
> I want all the nodes to work at the same time

Try to look into how sensors are sending the data, I think you will find the problem is on the sensor side, check the code there

---

<div class="post-metadata">

**Author:** ![shahrilmajid](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@shahrilmajid](https://discourse.nodered.org/u/shahrilmajid)\
**Post date:** [20 March 2022 07:16 UTC](https://discourse.nodered.org/t/how-to-send-data-from-two-sensor-at-the-same-time-using-mqtt/60097/5 "2022-03-20T07:16:58Z")

</div>

ok tq,, I have check and find the solution, the client id should be unique. tq all

---

<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:** [3 April 2022 07:17 UTC](https://discourse.nodered.org/t/how-to-send-data-from-two-sensor-at-the-same-time-using-mqtt/60097/6 "2022-04-03T07:17:39Z")

</div>

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