Github Devices Community Docs Blog

Wifi automatic reconnection issue with ESP32

Continuing the discussion from ESP32 BLE gateway dying every day and a half:


I prefer to separate the topic so as to narrow down the issue (strictly the fact that the gateway doesn’t reconnect automaticaly to wifi with certain router is in my point of view a different issue compared to BLE stability)

I have added a modification to the branch below:

Related to this issue on ESP32:

Hello, good news, it seems working fine now!

When the AP is down I see in log the following coming repeatedly:

MQTT client disconnected no BLE scan
BT Task running on core 0
MQTT connection…
[E][WiFiClient.cpp:232] connect(): connect on fd 55, errno: 118, “Host is unreachable”
failed, rc=

When the AP is up again, a new connection is made successfully, mqtt publishing starts again, everything is fine. Tried this several times and every time the ESP32 recovers the wifi connection successfully

One thing I noticed with previous versions was the the BT scanning (until it was turned off in last versions when there was no mqtt connection) always seemed to work even if the wifi was disconnected. So could this wifi disconnect, if it happened for any reason, actually have been the cause why the gateway was experienced as “dead”?

What I mean here is that one type of behavior (mqtt publishing ended) could have been caused by a another problem, i.e. temporary wifi connection error that was never recovered

Anyway, time will tell, so far it looks really good!!

PS In the serial monitor I see several devices being found, including my sonos speakers, but for some reason the text (manufacturerdata) is not readable, is it something in the platformio that can be adjusted, like supporting character set utf-8 or so? Or is it in the actual code where you publish the results to mqtt?




Great, thanks for helping me debug this!

I need some investigations so as to see what happens here