MQTT - Aedes - problem with 2 controllers

Newbie here - hi. And I mean new I. New to Arduino/MQTT/Node-Red etc.

I’m running Arduino Mkr1010 controllers communicating via WiFi, MQTT to Node-Red on a laptop. All goes well running a single arduino. Can subscribe, publish etc. My problem occurs when I try with two arduinos. The second keeps disconnecting from MQTT.

Is there anything obvious I should try? Or would you prefer to see code etc?

Cheers Alpal

Need to see code. One common mistake though is to forget to give the two Arduinos separate IP/MAC addresses.

Need see code in code tags.

Hello,

Even I have faced this problem. Both the device is having the same name. So when one device connects the other disconnects... We can have a better understanding with the code...

// Attempt to connect
if (client.connect("ESPthing")) //ESPthing is the name, change this for other arduino to //ESPthing1 or different
{   
Serial.println("connected");

You’re so right. I presumed when I copied the code that the field called “DEV_NAME” related to the device that contained the MQTT system not the calling device. It was declared adjacent to the Broker IP address and seemed logical at the time (newbie remember). Took two days of experimenting to finally work it out. Phew! Thanks for everyone’s help.