-->
Page 1 of 1

Multiple esp8266 on same network - connection issues?

PostPosted: Fri Dec 25, 2015 10:11 am
by shoelessone
Hello! Merry xmas! Happy Holidays! etc!

I just gave my family their "Mitchine" boxes, which are, as far as I know, working beautifully at this point (thanks in large part to this forum). But, one thing that I never tested (but knew MIGHT be an issue, hopefully solveable!) is connecting multiple esp8266 to the same network.

Currently, at the moment, it seems that one box connected to the network works beautifully. No problem. But when I connect a second box, only one of the boxes seems to work.

Code: Select allvoid ConfigureWifi()
{
   Serial.println("Configuring Wifi");
   WiFi.begin (config.ssid.c_str(), config.password.c_str());
   if (!config.dhcp)
   {
      WiFi.config(IPAddress(config.IP[0],config.IP[1],config.IP[2],config.IP[3] ),  IPAddress(config.Gateway[0],config.Gateway[1],config.Gateway[2],config.Gateway[3] ) , IPAddress(config.Netmask[0],config.Netmask[1],config.Netmask[2],config.Netmask[3] ));
   }
}


That's the relevant code for connecting to the network, in theory the box should be using DHCP though so only the first bit of code runs (and the ssid/password are correct - again the boxes connect just fine by themselves!).

Any ideas what might be causing this?

Also, FYI, the full code is available here: https://github.com/develpr/mitchine

Thank you for any tips!

Re: Multiple esp8266 on same network - connection issues?

PostPosted: Fri Dec 25, 2015 1:50 pm
by shoelessone
OK, I'm now thinking that the issue is actually with the mqtt connection. I'm wondering if I need to somehow use unique identifiers (which I don't see as being possible?) for the mqtt connection, or perhaps some other error related to mqtt. Possibly a problem resulting from the connect message I sent when you first connect to the mqtt server.

I'll keep digging I guess!

Re: Multiple esp8266 on same network - connection issues?

PostPosted: Sun Dec 27, 2015 10:15 am
by torntrousers
shoelessone wrote:... I'm wondering if I need to somehow use unique identifiers (which I don't see as being possible?) for the mqtt connection


Couldn't you use the mac address (WiFi.macAddress()) as part of the clientId to make each client unique?