ESP8266 unable to reconnect WiFi
Posted: Sun Dec 05, 2021 10:46 am
If I let my device connect to MQTT and deauth the device from my WiFi, it will not reconnect. If I run the same code, but to not connect to MQTT, WiFi reconnect works just fine. I have tried two different MQTT libraries with the same result, so I suspect it is something other than the MQTT lib itself.
Code with the problem is here:
https://github.com/gskjold/AmsToMqttBri ... /dev-1.6.0
Master brach is ok, see difference here:
gskjold/AmsToMqttBridge#154
ESP WiFi debugging enabled, output from start:
SDK:2.2.2-dev(38a443e)/Core:3.0.2=30002000/lwIP:STABLE-2_1_2_RELEASE/glue:1.2-48-g7421258/BearSSL:6105635
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 2
cnt
connected with no23-han, channel 1
dhcp client start...
wifi evt: 0
ip:192.168.233.207,mask:255.255.255.0,gw:192.168.233.1
wifi evt: 3
[hostByName] Host: 192.168.233.71 is a IP!
pm open,type:" 0
state: � -> " (!R8)
rm 0
pm close ?
wifi evt: 1
STA disconnect: 6
reconnect
state: " -> 0 (0)
scandone
state: 0 -> " (?8)
state: " -> @ (0)
state: @ -> � (i8)
add 0
aid "
cnt
state: � -> " (�R8)
rm 0
wifi evt: 1
STA disconnect: 2
reconnect
state: " -> 0 (0)
scandone
state: 0 -> " (?8)
state: " -> @ (0)
state: @ -> � (i8)
add 0
aid "
cnt
state: � -> " (�R8)
rm 0
wifi evt: 1
STA disconnect: 2
reconnect
state: " -> 0 (0)
scandone
state: 0 -> " (?8)
state: " -> @ (0)
state: @ -> � (i8)
add 0
aid "
cnt
state: � -> " (�R8)
rm 0
wifi evt: 1
STA disconnect: 2
Endless repeat of reconnect with disconnect: 2 (REASON_AUTH_EXPIRE)
Code with the problem is here:
https://github.com/gskjold/AmsToMqttBri ... /dev-1.6.0
Master brach is ok, see difference here:
gskjold/AmsToMqttBridge#154
ESP WiFi debugging enabled, output from start:
SDK:2.2.2-dev(38a443e)/Core:3.0.2=30002000/lwIP:STABLE-2_1_2_RELEASE/glue:1.2-48-g7421258/BearSSL:6105635
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 2
cnt
connected with no23-han, channel 1
dhcp client start...
wifi evt: 0
ip:192.168.233.207,mask:255.255.255.0,gw:192.168.233.1
wifi evt: 3
[hostByName] Host: 192.168.233.71 is a IP!
pm open,type:" 0
state: � -> " (!R8)
rm 0
pm close ?
wifi evt: 1
STA disconnect: 6
reconnect
state: " -> 0 (0)
scandone
state: 0 -> " (?8)
state: " -> @ (0)
state: @ -> � (i8)
add 0
aid "
cnt
state: � -> " (�R8)
rm 0
wifi evt: 1
STA disconnect: 2
reconnect
state: " -> 0 (0)
scandone
state: 0 -> " (?8)
state: " -> @ (0)
state: @ -> � (i8)
add 0
aid "
cnt
state: � -> " (�R8)
rm 0
wifi evt: 1
STA disconnect: 2
reconnect
state: " -> 0 (0)
scandone
state: 0 -> " (?8)
state: " -> @ (0)
state: @ -> � (i8)
add 0
aid "
cnt
state: � -> " (�R8)
rm 0
wifi evt: 1
STA disconnect: 2
Endless repeat of reconnect with disconnect: 2 (REASON_AUTH_EXPIRE)