[SOLVED] Off Topic - Weird issue with MQTT

I must have done something to my system about three weeks ago because I can no longer get any of my WeMos devices, with ESPEasy installed, to connect to a MQTT broker running on a Pi.

the broker is fine since NR on a Pi can use it to talk to my Mac or other Pi's
A WeMos with an arduino sketch can use it to talk to my Mac or other Pi's
But that same WeMos flashed with ESPEasy won't connect giving

12723098: MQTT : Intentional reconnect
12723430: MQTT : Failed to connect to broker

However, that same WeMos can connect and use an external broker (BeeBotte in this case).

I remembered flashing my Airport router with new firmware, so I reflashed it and rebooted - no change
I removed the Airport router and replaced it with a brand new TP-Link AC1750 router - no change

Any ideas on what I can look for to resolve this - AND I'm sure it is gong to be something simple and stupid, but I haven't been able to figure it out. Thanks in advance.


Any chance that the client ID's could have all become the same? That would cause issues. That would be my most likely guess.

Otherwise, it doesn't look like an IP address issue though I suppose it is possible.

Beyond that, I wouldn't know I don't think. Though if inspiration does strike, I'll let you know.

Have a look in the mosquito log in case anything useful there.
Have you specified an IP address for the pi in the devices? If so check the address has not changed in the pi.

1 Like

@colin - I think you have given me a clue. In the mosquitto log I see
1565375291: New connection from on port 1883.
1565375291: Socket error on client <unknown>, disconnecting.
1565375321: New connection from on port 1883.
1565375321: Socket error on client <unknown>, disconnecting.
1565375351: New connection from on port 1883.
1565375351: Socket error on client <unknown>, disconnecting.

All of the WeMos devices are failing with this.

Now to figure out why....(thoughts and suggestions welcome)

Do you use name and pwd authentication on mqtt?

nope, it's all local in the house so I don't bother...do you mean in the the mqtt connection or when setting up mqtt?

Can you connect to mqtt on the pi from a PC or similar, using a command line client or something.

I've been emailing with @dynamicdave and he shared his mosquitto config file. With that it started working.

I seem to remember updating mosquitto and rebuilding the config file and must have left someting out and I think it is the allow_anonymous true option.

I'm going to test that and will report back.

@Colin the only thing that had an issue was ESPEasy devices. Everything else used the broker with no problem. Even an arduino sketch worked, but I just looked and it is setup to use an mqtt user and password

I mentioned before about the client ID. You should set each device to have a different client id then you wouldn't need the anonymous option.

@TotallyInformation :pleading_face: you're right and I probably should do that, but I have it working again and you must realize it has been (dare I say) three weeks, three weeks, that I haven't been able to grab my phone when I wake up and turn the coffee pot on!! I've had to walk down stairs and manually flip the switch!!

I shall give it a day or two before I attempt to impliment a seperate user ID/password :stuck_out_tongue_winking_eye:

Always good to have a bit of summer exercise :smile:

1 Like

I can only imagine the horror :wink:

1 Like

I believe that allow_anonymous specifies whether to allow connection without user/pwd rather than being to do with client id. I don't see that there is any good reason to require user/pwd on a closed local system.

I am surprised that ESPEasy doesn't generate default client IDs. I use Tasmotta and if an ID is not defined for a device then it autogenerates one based on MAC address or something.