From 217e5a4833c281efe8987ea8942a2e85f2cd250a Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 11 Nov 2025 14:05:44 -0600 Subject: [PATCH] cleanups --- esphome/components/wifi/wifi_component.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/esphome/components/wifi/wifi_component.cpp b/esphome/components/wifi/wifi_component.cpp index 65a0e19c7c..aa7df768e6 100644 --- a/esphome/components/wifi/wifi_component.cpp +++ b/esphome/components/wifi/wifi_component.cpp @@ -1501,11 +1501,14 @@ void WiFiComponent::retry_connect() { this->state_ = WIFI_COMPONENT_STATE_STA_CONNECTING_2; WiFiAP params = this->build_params_for_current_phase_(); this->start_connecting(params, true); - return; } - // No valid target - fall through to set state to allow phase transition + return; } + // If we can't progress forward its likely because scanning failed + // or the stack is in a bad state after restart so we cooldown first + // and once it finishes, cooldown will call check_connecting_finished() + // which will progress the state machine ESP_LOGD(TAG, "Entering cooldown from state %d and phase %s", this->state_, LOG_STR_ARG(retry_phase_to_log_string(this->retry_phase_))); this->state_ = WIFI_COMPONENT_STATE_COOLDOWN;