[SOLVED] MQTT sonoff device cannot connect to broker rc 5

  • Platform information:
    • Hardware: I7
    • OS: Ubuntu 18.4
    • openHAB version: 2
      I know this is not really a openhab problem, but on the tasmota forum this issue was not accepted and they advised to ask it here.
      I have 2 T1 sonoff devices with tasmota.
      One of my T1 with tasmota is connecting to the MQtt server, the other one first give the error:
      MQT: Connect failed to 192.168.1.14:1883, rc 5. Retry in 10 sec
      By the way all esp and arduino devices are working good with mqtt and openhab

settings of the device:
device1:
MQTT Host 192.168.1.14
MQTT Port 1883
MQTT User openhab
MQTT Client rolluikebbadkamer
MQTT Topic bathR/window/shutter
MQTT Group Topic sonoffs
MQTT Full Topic cmnd/bathR/window/shutter/
MQTT Fallback Topic cmnd/rolluikenouderkamer_fb/

device2:
MQTT Host 192.168.1.14
MQTT Port 1883
MQTT User openhab
MQTT Client rolluikenouderkamer
MQTT Topic parentsR/window/shutter
MQTT Group Topic sonoffs
MQTT Full Topic cmnd/parentsR/window/shutter/
MQTT Fallback Topic cmnd/rolluikenouderkamer_fb/

Can anyone help me

Each Client connecting to the Server has a unique ClientId
MQTT Client rolluikebbadkamer_1
MQTT Client rolluikebbadkamer_2
or in tasmota DVES_%06X (6 last digit of mac)

Hi Mpampinos,
thanks for the fast answer, but i do not quit understand your answer.
I also tried it with these settings but still get the same errror
device1:

MQTT Host 192.168.1.14
MQTT Poort 1883
MQTT Gebruiker openhab
MQTT Client rol2
MQTT Topic bathR/window/shutter2
MQTT Groep Topic sonoffs
MQTT Volledig Topic cmnd/bathR/window/shutter2/
MQTT Fallback Topic cmnd/rol2_fb/

device2:

MQTT Host 192.168.1.14
MQTT Port 1883
MQTT User openhab
MQTT Client rol1
MQTT Topic parentsR/window/shutter1
MQTT Group Topic sonoffs
MQTT Full Topic cmnd/parentsR/window/shutter1/
MQTT Fallback Topic cmnd/rol1_fb/

Which tasmota Version is installed on your sonoff and which core Version?

This is what the _changelog files says:
6.4.1.1 20181224
I compiled the code my self, because I changed something in the interlocking code so that I can use it for roller shutters. (directly flipping between up and down).

Another strange thing is happening:
when I do “sudo systemctl restart mosquitto” I get the error:
MQT: Connect failed to 192.168.1.14:1883, rc -2. Retry in 10 sec
So rc=-2 instead of rc=5.
This error then occurs for both devices .
When I then run “sudo mosquitto”.
Both devices are getting a connection to the mosquitto broker.
There problem here is that error is getting back when I restart my ubuntu system.

That sounds a bit like the connection problems I observed with version 6.4.
Reverted back to 6.3.0 (build 2018.10.30 17:39:28 / Core-/SDK-Version 2_3_0/1.5.3(aec24ac9))
Although I had those problems on all my sonoff devices!

I had the same Problems with 6.4.1. and finally i went flashed my sonoff back to 6.4.0 with Core Version 2.4.2.

You can use the 6.4.0 firmware for shutters too. I have 16 sonoff T1 working in this configuration as a shutter switch.

I also used core 2.5.0 I am now trying to get it back to 2.4.2.
For the shutters I know, I changed it so that if the up switch is active and I then I press the down switch it will not only stop, but it will do down too.
I now remember vaguely that with the first switch it did not work in core version 2.5.0, so I changed to 2.4.3. My computer crashed in the meanwhile, so I had to reinstall everything. I will let you know if that will solve the problem

This is definitely working in 6.4.0.3 with 2.4.2 Core Version.

I did it with SetOption14 1.

Hi, only going back to 2.4.2 Core did not work.
I will now try with version 6.4.0.3

I now used 6.4.0.3 but it still does not work. While the other T1 device is working with 6.4.1.1.

No idea what the problem can be.

But why does it work when I start mosquitto manually?

Is the hue Emulation working?
Might be a possibility?

Patrick, what is the heu Emulation?

The sonoff can emulate a hue device.

With the hue binding you can add and control this device without using mqtt.

The sonoff can emulate a hue device.
With the hue binding you can add and control this device without using mqtt.

Found the problem: I always logged in without a user name on my mqtt broker, but I had configure a user name with password. I also had the option allow_anonymous to true. So it is possible to login without a user name. But since it is not possible to NOT use a user name in tasmota ( it is always has a default name), it was asking for a password, which I did not fill.
When I filled in the correct username and password everything worked fine.!

Thanks for all the Help and Time !!