J. Nick Koston 874b30d97d [wifi] Fix roaming attempt counter reset on disconnect during scan
When WiFi disconnects while a roaming scan is in progress, the
SCANNING state was transitioning to IDLE in retry_connect(). When the
device then reconnected, check_connecting_finished() treated the IDLE
state as a normal connection and reset roaming_attempts_ to 0. This
caused the roaming counter to perpetually restart at 1/3 instead of
progressing to 2/3, 3/3, creating an infinite loop of roaming scans
every 5 minutes.

This is most likely to occur on ESP8266 where disconnect callbacks
run immediately in SDK system context (setting error_from_callback_
before the main loop can process scan results), compared to ESP32 IDF
where events are queued and the scan-done event is typically processed
before the disconnect.

Fix by transitioning to RECONNECTING instead of IDLE when a disconnect
occurs during SCANNING. This preserves the attempts counter on
successful reconnection, allowing the device to reach the 3-attempt
limit and stop scanning.
2026-03-22 18:04:58 -10:00
2025-12-21 09:26:03 -05:00
2025-12-08 14:37:45 -05:00
2026-03-12 07:34:53 +13:00
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme Multiple Licenses 588 MiB
Languages
C++ 63.4%
Python 36.2%
C 0.3%