I have an issue with ESP 32 devkit v1, it is rebooting every 20 minutes with an almost bare bone sketch. Tested on 2 boards with the same results.
The board is not connected to anything and it is powered from usb charger. Before writing this to the board, I had a sketch from arduino and didn’t reboot.
I’ve had 2 boards with framework arduino and esp-idf for 8+ hours, the esp-idf din’t restarted but the arduino one restarted 3 times. The behavior for the arduino framework version is: it stays on for was 2h 24-38min after that the mqtt stops ~15min and board reboots.
I don’t have any logs because the board was not connected to the pc and on mqtt didn’t receive anything
I don’t think so but I don’t have history of the values for the IDF version as HA doesn’t recognize it as a device (even it’s receiving the mqtt messages from the esp with different topic).
I’ve changed the board to the generic one, as someone from a local group has an identical board and he doesn’t has any issues with it. Forgot to mention that the board is not original DOIT, it’s a clone.
I don’t have a final resolution but it seams that if the code gets more complex the reboots get more often. Now on an other board that was rebooting every 30min is now on for 87min.
I do not think it is MQTT, but instead the WiFi module.
If I recall correctly, then it has a 5 minutes retry session for connecting, then the fallback AP and captive portal kicks in for 15 minutes and then it reboots.
I’ve added all the functionality that I need to the board (BME sensor still disconnected) and I was following mqtt debug logs for a reboot.
This is the reboot logs:
[17:57:06][I][waveshare_epaper:473]: Wake up the display
[17:57:06][I][waveshare_epaper:646]: Set the display back to deep sleep
[17:57:07][W][component:239]: Component display took a long time for an operation (724 ms).
[17:57:07][W][component:240]: Components should block for at most 30 ms.
[17:57:28][W][component:172]: Component mqtt cleared Warning flag
[17:57:28][I][mqtt:291]: MQTT Connected!
[17:57:28][I][app:062]: setup() finished successfully!
[17:57:28][I][app:100]: ESPHome version 2025.4.2 compiled on May 15 2025, 17:00:02
[17:57:28][C][wifi:600]: WiFi:
Followed by the rest of the initialization logs
Start with the MOST minimal config provided and connect it to a computer that is set to stay on, so you have the serial log. That will probably not show the issue, so you can know that your board is okay or not. Then you can change ONE thing at a time until it fails and you will know what caused the issue.
[18:56:03][D][sensor:094]: 'ESP Uptime': Sending state 89.85098 min with 0 decimals of accuracy
[18:56:13][D][sensor:094]: 'ESP Uptime': Sending state 90.01768 min with 0 decimals of accuracy
[18:56:21][D][esp-idf:000][mqtt_task]: E (5413607) MQTT_CLIENT: No PING_RESP, disconnected
[18:56:21]
[18:56:21][W][mqtt:340]: MQTT Disconnected: TCP disconnected.
[18:56:21][W][component:157]: Component mqtt set Warning flag: unspecified
[18:56:21][I][mqtt:250]: Connecting to MQTT...
[18:56:23][D][sensor:094]: 'ESP Uptime': Sending state 90.18435 min with 0 decimals of accuracy
[18:56:33][D][sensor:094]: 'ESP Uptime': Sending state 90.35102 min with 0 decimals of accuracy
[18:56:43][D][sensor:094]: 'ESP Uptime': Sending state 90.51768 min with 0 decimals of accuracy
[18:56:46][D][esp-idf:000][mqtt_task]: E (5438619) esp-tls: [sock=49] select() timeout
[18:56:46]
[18:56:46][D][esp-idf:000][mqtt_task]: E (5438621) TRANSPORT_BASE: Failed to open a new connection: 32774
[18:56:46]
[18:56:46][D][esp-idf:000][mqtt_task]: E (5438631) MQTT_CLIENT: Error transport connect
[18:56:46]
[18:56:46][E][mqtt.idf:162]: MQTT_EVENT_ERROR
[18:56:46][E][mqtt.idf:164]: Last error code reported from esp-tls: 0x8006
[18:56:46][E][mqtt.idf:165]: Last tls stack error number: 0x0
[18:56:46][E][mqtt.idf:167]: Last captured errno : 0 (Success)
[18:56:46][W][mqtt:340]: MQTT Disconnected: TCP disconnected.
[18:56:46][I][mqtt:250]: Connecting to MQTT...
[18:56:53][D][sensor:094]: 'ESP Uptime': Sending state 90.68435 min with 0 decimals of accuracy
[18:57:03][D][sensor:094]: 'ESP Uptime': Sending state 90.85102 min with 0 decimals of accuracy
[18:57:11][D][esp-idf:000][mqtt_task]: E (5463649) esp-tls: [sock=49] select() timeout
[18:57:11]
[18:57:11][D][esp-idf:000][mqtt_task]: E (5463651) TRANSPORT_BASE: Failed to open a new connection: 32774
It kept the loop to try connecting until here:
[20:36:28][I][mqtt:250]: Connecting to MQTT...
[20:36:33][D][sensor:094]: 'ESP Uptime': Sending state 190.35596 min with 0 decimals of accuracy
[20:36:43][D][sensor:094]: 'ESP Uptime': Sending state 190.52263 min with 0 decimals of accuracy
[20:36:53][D][esp-idf:000][mqtt_task]: E (11445611) esp-tls: [sock=49] select() timeout
[20:36:53]
[20:36:53][D][esp-idf:000][mqtt_task]: E (11445613) TRANSPORT_BASE: Failed to open a new connection: 32774
[20:36:53]
[20:36:53][D][esp-idf:000][mqtt_task]: E (11445623) MQTT_CLIENT: Error transport connect
[20:36:53]
[20:36:53][E][mqtt.idf:162]: MQTT_EVENT_ERROR
[20:36:53][E][mqtt.idf:164]: Last error code reported from esp-tls: 0x8006
[20:36:53][E][mqtt.idf:165]: Last tls stack error number: 0x0
[20:36:53][E][mqtt.idf:167]: Last captured errno : 0 (Success)
[20:36:53][W][mqtt:340]: MQTT Disconnected: TCP disconnected.
[20:36:53][I][mqtt:250]: Connecting to MQTT...
[20:36:53][D][sensor:094]: 'ESP Uptime': Sending state 190.68929 min with 0 decimals of accuracy
[20:37:03][D][sensor:094]: 'ESP Uptime': Sending state 190.85596 min with 0 decimals of accuracy
[20:37:13][D][sensor:094]: 'ESP Uptime': Sending state 191.02263 min with 0 decimals of accuracy
[20:37:17][W][component:172]: Component mqtt cleared Warning flag
[20:37:17][I][mqtt:291]: MQTT Connected!
[20:37:17][W][component:239]: Component mqtt took a long time for an operation (114 ms).
[20:37:17][W][component:240]: Components should block for at most 30 ms.
[20:37:23][D][sensor:094]: 'ESP Uptime': Sending state 191.18929 min with 0 decimals of accuracy
[20:37:33][D][sensor:094]: 'ESP Uptime': Sending state 191.35597 min with 0 decimals of accuracy
[20:37:43][D][sensor:094]: 'ESP Uptime': Sending state 191.52264 min with 0 decimals of accuracy
After first boot it worked for ~93min then it was in error for ~101 min, it recovered and worked for 89 min, after was in error for ~104min. The error was always the same.
Sorry for that I had the impression that I’ve flashed the file and yes I’ve used the same structure with IDF framework before.
I will try it again with arduino framework.
Thank you for the support so far.
So my setup is like this, HA is running on a PI 4 and is also creating the wifi network,on wlan0, that the esp connects to. Both devices are on my desk so poor connection is excluded.
Do this E (5413607) MQTT_CLIENT: No PING_RESP, disconnected means that the ESP is not receiving a response form HA? I’m trying to narrow the debug to one device ESP or HA.
That is not necessarily true. Poor connection does not equal ONLY low signal strength. That frequently is the cause of a poor connection, but not the only cause of one.
The error message is saying “I can’t communicate”. That can be for a variety of reasons. You have a more complicated network setup than “normal”. Is there a reason for it? Don’t you have a reliable wireless network you can use. Your current setup looks like it needs routing to work, which can be complicated to get set up correctly.
Since things are not working reliably, I would go for an even more basic configuration (of network and everything) and once that is working add the complexity you need back one step at a time.