SonOff Basic R2 connection problem


I have had the problem for some time now that my two SonOff Basic R2 (flashed with Tasmota) don’t seem to like being connected to my MQTT broker.

After setting up everything worked without problems, but for a few weeks my wife has been complaining that the lighting in the bedroom does not work reliably, especially during the day, and after looking at the Tasmota console of the relays I immediately noticed that the two are not connected to the MQTT broker anymore. Or that the connection seems not to be stable. Because sometimes it works for a few hours and than loses the connection and wont connect for hours or even days.
I have nearly twenty devices connected to my Broker and never recognized such a behavior before.

This manifests itself with the error message:

MQT: connection failed due to IP:port, rc -2. Retry in

My first approach was to update Tasmota to V12.1.1. Did not change anything.

Update Eclipse Mosquitto MQTT Broker to V2.0.15. Didn’t change anything either.

After a bit of search engine research I read a tip somewhere to downgrade Tasmota to V8.5.1. Did not change anything.

Adjusting the MQTT settings didn’t help either.

I’m quite new to this topic, so I don’t know any other way to track down the error here.

If you have any suggestions, please describe them in such a way that even a beginner can do them.

Thank you so much for your help!!!

My first guess, as you mention that two devices are affected, is that you have the same MQTT client id in both devices. The client id must be unique on the broker, so those two devices would be in a battle with each other continuously connecting, then being disconnected because the other device connected. If this is the problem, then changing the client id on one of the devices will fix it.

Let me know if that helps.



Hey Roger,
thanks so much for reading through my post and writing a reply!!!

I tried to connect just one of the relays to the Broker but this doesn’t change anything.
It should work if just one is connected?! Im right with my guess?


Yes, if just one client was trying to connect then you should not have the issue.

I’m not sure what to suggest next that isn’t too technical - could you perhaps try connecting a completely different client but using the same connection details as the problem relay? If that works then the problem must be with the relay and I can’t much help there.