# MQTT won't connect between two networked devices

**URL:** <https://discourse.nodered.org/t/mqtt-wont-connect-between-two-networked-devices/47871>\
**Category:** General\
**Created:** [1 July 2021 02:09 UTC](https://discourse.nodered.org/t/mqtt-wont-connect-between-two-networked-devices/47871 "2021-07-01T02:09:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![DrdP](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@DrdP](https://discourse.nodered.org/u/DrdP)\
**Post date:** [1 July 2021 02:09 UTC](https://discourse.nodered.org/t/mqtt-wont-connect-between-two-networked-devices/47871/1 "2021-07-01T02:09:54Z")

</div>

Hi All,

I need some help with Mqtt.

I have a RPI4B connected via a switch to an IFM AL1341. I can not get the broker to communicate with each other.  
I have tested mqtt operation with localhost:1883 sending hello world.  
RPI :192.168.1.150  
IFM: 192.168.1.157

I have configured the mqtt in with 192.168.1.157:1883 and have not had any connection. in the flow I am pinging the IFM IO link block and recieve a packet so the network is working. Mqtt is confusing me with what is needed to get the communication going? I have a SA4100 connected to the IFM module reading Temperature.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/b/1b66dad322abd79a0ec2c02ff32630c820ea21bf.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/9/f9b96fdf259ea1a0a24e044dbb84b3406c656ad3.png)

Thanks in Advance

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 July 2021 04:37 UTC](https://discourse.nodered.org/t/mqtt-wont-connect-between-two-networked-devices/47871/2 "2021-07-01T04:37:07Z")

</div>

So the RasPi is the broker - yes?  
`192.168.1.150`

> [@DrdP](#):
>
> I have configured the mqtt in with 192.168.1.157:1883

Ok, so looking at the screen shot you have 4 nodes way at the top.  
An `inject` node; an `MQTT out` node' an `MQTT in` node and a `debug` node.

Select them and export them and paste the code here.

Select - _drag the mouse around/over them_  
Export - top right corner of the node-red edit screen the _burger_ (3 bars) and select `export`  
Copy to clip board  
Paste here - sorry, I haven't got the words to explain how to do that.  
But there is a button at the top of the _window_ where you enter the text and it looks like:  
`</>`  
Click it, paste the code.

I hope that helps.

Oh P.S.

Actually this node may be of more interest as the other two are connected.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/b/0b6ade47a0f99d679f41340b6ccc0f39d5a1a3ab.png)

Export it and paste the code here.

---

<div class="post-metadata">

**Author:** ![stefan24](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stefan24/32/23075_2.png) [@stefan24](https://discourse.nodered.org/u/stefan24)\
**Post date:** [1 July 2021 05:30 UTC](https://discourse.nodered.org/t/mqtt-wont-connect-between-two-networked-devices/47871/3 "2021-07-01T05:30:19Z")

</div>

I think, you have to search for the basics of MQTT.  
You have installed the Broker at the Pi?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 July 2021 07:16 UTC](https://discourse.nodered.org/t/mqtt-wont-connect-between-two-networked-devices/47871/4 "2021-07-01T07:16:09Z")

</div>

> [@DrdP](#):
>
> I can not get the broker to communicate with each other.

Brokers do not (generally) communicate with each other. MQTT clients communicate with a broker. This excellent tutorial will tell you what you need to know about MQTT [MQTT Essentials - All Core Concepts Explained](https://www.hivemq.com/mqtt-essentials/)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 July 2021 07:19 UTC](https://discourse.nodered.org/t/mqtt-wont-connect-between-two-networked-devices/47871/5 "2021-07-01T07:19:43Z")

</div>

But it has been shown message sending has been established by the two nodes (4) at the top of the screen shot where a message is sent and received via MQTT.

---

<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:** [1 July 2021 08:06 UTC](https://discourse.nodered.org/t/mqtt-wont-connect-between-two-networked-devices/47871/6 "2021-07-01T08:06:30Z")

</div>

There must\* be only one broker.

All clients (node-red is a client, your device is a client) talk to **ONE** broker

That is the definition of a broker ( A _broker_ is an intermediary between clients )

[This thread](https://discourse.nodered.org/t/new-user-odd-stiuation/45742/19) might help you get it.

\* there can of course be more than one broker but for what you are trying to achieve, there should only be one broker

---

<div class="post-metadata">

**Author:** ![DrdP](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@DrdP](https://discourse.nodered.org/u/DrdP)\
**Post date:** [6 July 2021 23:55 UTC](https://discourse.nodered.org/t/mqtt-wont-connect-between-two-networked-devices/47871/7 "2021-07-06T23:55:26Z")

</div>

Thank you @Steve-Mcl ,

I figured it out eventually. Im an Automation Engineer so in my mind the clients needed to be connected or reference each other somehow like a PLC and a Remote IO Node would interface with send receive messages.

Thanks

---

<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:** [20 July 2021 23:55 UTC](https://discourse.nodered.org/t/mqtt-wont-connect-between-two-networked-devices/47871/8 "2021-07-20T23:55:36Z")

</div>

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