Tasmota: MQT: Connect failed, rc8

Created on 29 Aug 2018  路  19Comments  路  Source: arendst/Tasmota

Make sure these boxes are checked [x] before submitting your issue - Thank you!

  • [x ] Searched the problem in issues (https://github.com/arendst/Sonoff-Tasmota/issues)
  • [ x] Searched the problem in the wiki (https://github.com/arendst/Sonoff-Tasmota/wiki/Troubleshooting)
  • [] Searched the problem in the forum (https://groups.google.com/d/forum/sonoffusers)
  • [x ] Searched the problem in the chat (https://discord.gg/Ks2Kzd4)
  • [x ] Hardware used : Sonoff Basic
  • [x ] Provide the output of command status 0 :
19:09:24 MQT: stat/sonoff01/STATUS = {"Status":{"Module":1,"FriendlyName":["Sonoff 01 K眉che Rechts"],"Topic":"sonoff01","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":7,"SaveData":2,"SaveState":1,"ButtonRetain":0,"PowerRetain":1}}
19:09:24 MQT: stat/sonoff01/STATUS1 = {"StatusPRM":{"Baudrate":115200,"GroupTopic":"sonoffs","OtaUrl":"http://sonoff.maddox.co.uk/tasmota/sonoff.bin","RestartReason":"Software/System restart","Uptime":"0T23:46:11","StartupUTC":"2018-08-28T17:23:13","Sleep":5,"BootCount":1,"SaveCount":52,"SaveAddress":"F8000"}}
19:09:24 MQT: stat/sonoff01/STATUS2 = {"StatusFWR":{"Version":"6.1.1","BuildDateTime":"2018-08-28T19:19:41","Boot":6,"Core":"2_4_1","SDK":"2.2.1(cfd48f3)"}}
19:09:24 MQT: stat/sonoff01/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["Naitsabes","sebsmarthome"],"TelePeriod":600,"SetOption":["00008029","55818000"]}}
19:09:24 MQT: stat/sonoff01/STATUS4 = {"StatusMEM":{"ProgramSize":495,"Free":508,"Heap":19,"ProgramFlashSize":1024,"FlashSize":1024,"FlashMode":3,"Features":["00000809","0FC0A984","0C000000","01001496","00000000"]}}
19:09:24 MQT: stat/sonoff01/STATUS5 = {"StatusNET":{"Hostname":"sonoff01-2179","IPAddress":"192.168.10.151","Gateway":"192.168.10.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.10.1","Mac":"5C:CF:7F:B4:A8:83","Webserver":2,"WifiConfig":2}}
19:09:24 MQT: stat/sonoff01/STATUS6 = {"StatusMQT":{"MqttHost":"192.168.10.150","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_B4A883","MqttUser":"sonoff01","MqttType":2,"MAX_PACKET_SIZE":1000,"KEEPALIVE":15}}
19:09:24 MQT: stat/sonoff01/STATUS7 = {"StatusTIM":{"UTC":"Wed Aug 29 17:09:24 2018","Local":"Wed Aug 29 19:09:24 2018","StartDST":"Sun Mar 25 02:00:00 2018","EndDST":"Sun Oct 28 03:00:00 2018","Timezone":99,"Sunrise":"06:28","Sunset":"20:02"}}
19:09:24 MQT: stat/sonoff01/STATUS10 = {"StatusSNS":{"Time":"2018-08-29T19:09:24"}}
19:09:24 MQT: stat/sonoff01/STATUS11 = {"StatusSTS":{"Time":"2018-08-29T19:09:24","Uptime":"0T23:46:11","Vcc":3.405,"POWER":"OFF","Wifi":{"AP":1,"SSId":"Naitsabes","RSSI":64,"APMac":"C8:0E:14:02:3D:E1"}}}

I get disconneted form MQTT server every few minutes.
Its a sonoff basic with 6.1.1 installed, updated from 5.12.0a via uploading a self compiled bin file.
Using #define MQTT_LIBRARY_TYPE MQTT_TASMOTAMQTT
When it looses connection it turn off (there is a light connected to it) and once it connects again it turn the light back on since the last POWER message from HomeAssistant is retained.
I already looked at the possible error codes for MQTT here:
https://github.com/arendst/Sonoff-Tasmota/wiki/MQTT-Overview#troubleshooting
but "rc8" is not found there

Here is the sonsole output from that sonoff:

22:23:18 MQT: cmnd/sonoff01/POWER = 
22:23:18 MQT: stat/sonoff01/RESULT = {"POWER":"OFF"}
22:23:18 MQT: stat/sonoff01/POWER = OFF (retained)
22:23:34 MQT: Connect failed to 192.168.10.150:1883, rc 8. Retry in 10 sec
22:23:35 WIF: Connecting to AP1 Naitsabes in mode 11N as sonoff01-2179...
22:23:39 WIF: Connected
22:23:40 MQT: Connected
22:23:40 MQT: tele/sonoff01/LWT = Online (retained)
22:23:40 MQT: cmnd/sonoff01/POWER = 
22:23:40 MQT: stat/sonoff01/RESULT = {"POWER":"OFF"}
22:23:40 MQT: stat/sonoff01/POWER = OFF (retained)
22:23:59 WIF: Connecting to AP1 Naitsabes in mode 11N as sonoff01-2179...
22:24:03 WIF: Connected
22:25:55 MQT: Connect failed to 192.168.10.150:1883, rc 8. Retry in 10 sec
22:26:01 MQT: Connected
22:26:01 MQT: tele/sonoff01/LWT = Online (retained)
22:26:01 MQT: cmnd/sonoff01/POWER = 
22:26:01 MQT: stat/sonoff01/RESULT = {"POWER":"OFF"}
22:26:01 MQT: stat/sonoff01/POWER = OFF (retained)
22:26:33 MQT: Connect failed to 192.168.10.150:1883, rc 8. Retry in 10 sec
22:26:39 MQT: Connected
22:26:39 MQT: tele/sonoff01/LWT = Online (retained)
22:26:39 MQT: cmnd/sonoff01/POWER = 
22:26:39 MQT: stat/sonoff01/RESULT = {"POWER":"OFF"}
22:26:39 MQT: stat/sonoff01/POWER = OFF (retained)
22:26:42 MQT: tele/sonoff01/STATE = {"Time":"2018-08-28T22:26:42","Uptime":"0T03:03:29","Vcc":3.404,"POWER":"OFF","Wifi":{"AP":1,"SSId":"Naitsabes","RSSI":68,"APMac":"C8:0E:14:02:3D:E1"}}
22:30:25 MQT: Connect failed to 192.168.10.150:1883, rc 8. Retry in 10 sec
22:30:31 MQT: Connected
22:30:31 MQT: tele/sonoff01/LWT = Online (retained)
22:30:31 MQT: cmnd/sonoff01/POWER = 
22:30:31 MQT: stat/sonoff01/RESULT = {"POWER":"OFF"}
22:30:31 MQT: stat/sonoff01/POWER = OFF (retained)
22:30:51 WIF: Connecting to AP1 Naitsabes in mode 11N as sonoff01-2179...
22:30:54 WIF: Connected
22:30:55 MQT: Connect failed to 192.168.10.150:1883, rc 8. Retry in 10 sec
22:31:01 MQT: Connected
22:31:01 MQT: tele/sonoff01/LWT = Online (retained)
22:31:01 MQT: cmnd/sonoff01/POWER = 
22:31:01 MQT: stat/sonoff01/RESULT = {"POWER":"OFF"}
22:31:01 MQT: stat/sonoff01/POWER = OFF (retained)
22:32:21 MQT: Connect failed to 192.168.10.150:1883, rc 8. Retry in 10 sec
22:32:27 MQT: Connected
22:32:27 MQT: tele/sonoff01/LWT = Online (retained)
22:32:27 MQT: cmnd/sonoff01/POWER = 
22:32:27 MQT: stat/sonoff01/RESULT = {"POWER":"OFF"}
22:32:27 MQT: stat/sonoff01/POWER = OFF (retained)
22:33:45 MQT: Connect failed to 192.168.10.150:1883, rc 8. Retry in 10 sec
22:33:51 MQT: Connected
22:33:51 MQT: tele/sonoff01/LWT = Online (retained)
22:33:51 MQT: cmnd/sonoff01/POWER = 
22:33:51 MQT: stat/sonoff01/RESULT = {"POWER":"OFF"}
22:33:51 MQT: stat/sonoff01/POWER = OFF (retained)
22:34:38 WIF: Connecting to AP1 Naitsabes in mode 11N as sonoff01-2179...
22:34:39 MQT: Connect failed to 192.168.10.150:1883, rc 8. Retry in 10 sec
22:34:42 WIF: Connected
22:34:45 MQT: Connected
22:34:45 MQT: tele/sonoff01/LWT = Online (retained)
22:34:45 MQT: cmnd/sonoff01/POWER = 
22:34:45 MQT: stat/sonoff01/RESULT = {"POWER":"OFF"}
22:34:45 MQT: stat/sonoff01/POWER = OFF (retained)
22:36:54 MQT: tele/sonoff01/STATE = {"Time":"2018-08-28T22:36:54","Uptime":"0T03:13:41","Vcc":3.403,"POWER":"OFF","Wifi":{"AP":1,"SSId":"Naitsabes","RSSI":68,"APMac":"C8:0E:14:02:3D:E1"}}
22:37:45 WIF: Connecting to AP1 Naitsabes in mode 11N as sonoff01-2179...
22:37:48 WIF: Connected
22:39:09 MQT: Connect failed to 192.168.10.150:1883, rc 8. Retry in 10 sec
22:39:09 WIF: Connecting to AP1 Naitsabes in mode 11N as sonoff01-2179...
22:39:13 WIF: Connected
22:39:15 MQT: Connected
22:39:15 MQT: tele/sonoff01/LWT = Online (retained)
22:39:15 MQT: cmnd/sonoff01/POWER = 
22:39:15 MQT: stat/sonoff01/RESULT = {"POWER":"OFF"}
22:39:15 MQT: stat/sonoff01/POWER = OFF (retained)
22:39:33 WIF: Connecting to AP1 Naitsabes in mode 11N as sonoff01-2179...
22:39:37 WIF: Connected
22:40:56 MQT: Connect failed to 192.168.10.150:1883, rc 8. Retry in 10 sec
22:41:02 MQT: Connected
22:41:02 MQT: tele/sonoff01/LWT = Online (retained)
22:41:02 MQT: cmnd/sonoff01/POWER = 
22:41:02 MQT: stat/sonoff01/RESULT = {"POWER":"OFF"}
22:41:02 MQT: stat/sonoff01/POWER = OFF (retained)
22:41:18 MQT: Connect failed to 192.168.10.150:1883, rc 8. Retry in 10 sec
22:41:19 WIF: Connecting to AP1 Naitsabes in mode 11N as sonoff01-2179...
22:41:22 WIF: Connected
22:41:24 MQT: Connected
22:41:24 MQT: tele/sonoff01/LWT = Online (retained)
22:41:24 MQT: cmnd/sonoff01/POWER = 
22:41:24 MQT: stat/sonoff01/RESULT = {"POWER":"OFF"}
22:41:24 MQT: stat/sonoff01/POWER = OFF (retained)

And here is the log from my Mosquitto broker (Home Assistant Addon):

1535560611: Socket error on client DVES_B4A883, disconnecting.
1535560617: New connection from 192.168.10.151 on port 1883.
1535560617: New client connected from 192.168.10.151 as DVES_B4A883 (c1, k15, u'sonoff01').
1535560644: Socket error on client DVES_B4A883, disconnecting.
1535560647: New connection from 192.168.10.151 on port 1883.
1535560647: New client connected from 192.168.10.151 as DVES_B4A883 (c1, k15, u'sonoff01').
1535560687: Socket error on client DVES_B4A883, disconnecting.
1535560690: New connection from 192.168.10.151 on port 1883.
1535560690: New client connected from 192.168.10.151 as DVES_B4A883 (c1, k15, u'sonoff01').
1535560744: Socket error on client DVES_4BDB08, disconnecting.
1535560748: New connection from 192.168.10.233 on port 1883.
1535560748: New client connected from 192.168.10.233 as DVES_4BDB08 (c1, k15, u'h803').
1535560752: New connection from 192.168.10.151 on port 1883.
1535560752: Client DVES_B4A883 already connected, closing old connection.
1535560752: Client DVES_B4A883 disconnected.
1535560752: New client connected from 192.168.10.151 as DVES_B4A883 (c1, k15, u'sonoff01').
1535560843: Socket error on client DVES_B4A883, disconnecting.
1535560849: New connection from 192.168.10.151 on port 1883.
1535560849: New client connected from 192.168.10.151 as DVES_B4A883 (c1, k15, u'sonoff01').
1535560855: Socket error on client DVES_4BDB08, disconnecting.
1535560858: New connection from 192.168.10.233 on port 1883.
1535560858: New client connected from 192.168.10.233 as DVES_4BDB08 (c1, k15, u'h803').
1535560911: Socket error on client DVES_4BDB08, disconnecting.
1535560914: New connection from 192.168.10.233 on port 1883.
1535560914: New client connected from 192.168.10.233 as DVES_4BDB08 (c1, k15, u'h803').
1535560921: Socket error on client DVES_B4A883, disconnecting.
1535560924: New connection from 192.168.10.151 on port 1883.
1535560924: New client connected from 192.168.10.151 as DVES_B4A883 (c1, k15, u'sonoff01').
1535560976: Socket error on client DVES_855D9F, disconnecting.
1535560983: Socket error on client DVES_B4A883, disconnecting.
1535560986: New connection from 192.168.10.151 on port 1883.
1535560986: New client connected from 192.168.10.151 as DVES_B4A883 (c1, k15, u'sonoff01').

This also seems to happen to one of my other devices (h803) as you can see from the log. That device is a H801 with 6.1.1 installed (also using MQTT_TASMOTAMQTT). Funny enough I have two more H801 devices with the same software installed but not having that problem...

Any help would be very nice, and if you need any more info I am happy to provide that or help however I can.

awaiting feedback troubleshooting

All 19 comments

Hi, you are using esp lib v2.4.1. That library has several wifi problems. Instead use esp lib v2.3.0 or v2.4.2.

Thanks for the tip.
Looking at this comparison, I will try using v2.4.2
I will report back once I get 6.1.1 with core 2.4.2 running

EDIT:
Should I just change this code block in the "platformio.ini" file to use the lastest?

[common] ; ************************************************************
; *** Esp8266 core for Arduino version 2.3.0
;platform = [email protected]
; *** Esp8266 core for Arduino version 2.4.0
;platform = [email protected]
; *** Esp8266 core for Arduino version 2.4.1
platform = [email protected]
; *** Esp8266 core for Arduino current version
;platform = espressif8266

In 2.4.2 you have also 2 more options when compiling (lwIP 1.4 and lwIP 2). In my tests lwIP 1.4 was more stable, but you need to test them in order to know which one works better with your router.

You use a old version. Here is 2.4.2 not listed.
You can use 2.3.0 this version is stable and very reliable.
Just uncomment (delete ; at the beginning of the line)

Yes, 2.3.0 has been proved to be the more stable and recommended

I flashed another sonoff with my version of 6.1.1 just changing the platform to latest and I got core version 2.4.1

{"StatusFWR":{"Version":"6.1.1","BuildDateTime":"2018-08-29T20:04:05","Boot":6,"Core":"2_4_1","SDK":"2.2.1(cfd48f3)"}}

But if you recommend 2.3.0 I will try that

In case you want to try v2.4.2 use as follow:

[common] ; ************************************************************
; *** Esp8266 core for Arduino version 2.3.0
;platform = [email protected]
; *** Esp8266 core for Arduino version 2.4.0
;platform = [email protected]
; *** Esp8266 core for Arduino version 2.4.1
;platform = [email protected]
; *** Esp8266 core for Arduino version 2.4.2
platform = [email protected]
; *** Esp8266 core for Arduino version latest beta
;platform = https://github.com/platformio/platform-espressif8266.git#feature/stage
; *** Esp8266 core for Arduino current version (located in %USERPROFILE%\.platformio\platforms\espressif8266)
;platform = espressif8266

build_flags =
  -Wl,-Tesp8266.flash.1m0.ld
;  -DUSE_CONFIG_OVERRIDE  
; lwIP 1.4 (Default)
  -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
; lwIP 2 - Low Memory
;  -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
; lwIP 2 - Higher Bandwitdh
;  -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH
; VTABLES in Flash (default)
  -DVTABLES_IN_FLASH
; VTABLES in Heap
;  -DVTABLES_IN_DRAM
; VTABLES in IRAM
;  -DVTABLES_IN_IRAM

You need to have only one option. the rest of the platform options NEED to be with ;

if not platformio will use the last defined

Ok, I have "upgraded" the sonoff in question to core v2.3.0, I will monitor now and see if the problem is gone.
what does the error code rc8 even mean, I was not able to find that...

And are there big downsides in using 2.4.2 instead of 2.3.0, I just like the idea of not having the Krack vulnerability.? (the other bugs in 2.4.2, e.g. hue bridge emulation problem are things that I dont care about)

Sleep doesnt work in 2.4.2.

rc 8 == TCP_RECONNECT_DISCONNECTING

https://github.com/arendst/Sonoff-Tasmota/issues/2930#issuecomment-395421037

Well it seems I am down to 2.3.0 anyways because 2.4.2 does not want to compile after I added the needed code that @ascillato posted above.

Somehow I cant copy past out of the log from Atom, so here is the error, something about WPS beeing unavailable (I am using Wifi Manager as the fallback in case primary and secondary APs are not available)
image

But I guess I can just wait until the release where 2.4.2 (or something after that) becomes the default core.

EDIT: @meingraham thanks for the info!

Please download it again. Your setup seems corrupted.
It does compile without errors.

Click this, wait and try to compile again:

image

Is your broker up to date? Maybe the problems comes from a old version.

@Jason2866 @ascillato
thanks for the tips, sadly none of them helped to build with core v2.4.2
still getting the same error, I even tried downloading a fresh copy and not touching user_config.h and only making two changes to the "platformio.ini"
1) env_default = sonoff
2) platform = [email protected]

But on the bright side I did not have any MQTT reconnects or errors on the sonoff in question since it is running 6.1.1 with core v2.3.0.
So for the matter of this issue it was succesfully solved by going to core 2.3.0
Thanks a lot for your help with that.

If you dont care we can still try to get v2.4.2 working for me, but I understand if you dont want to continue this here...

Will be better to chat directly. Please connect to Tasmota chat at: https://discord.gg/Ks2Kzd4

@nightcat91
Glad connections works.
I have no idea left why compiling with 2.4.2 fails. Sorry

for anyone having the same problem about core v2.4.2 not compiling with the error I posted above.
-> Download the latest dev version (for me V6.1.1.13) fixed it.

Was this page helpful?
0 / 5 - 0 ratings