diff --git a/esphome/components/wifi/wifi_component.cpp b/esphome/components/wifi/wifi_component.cpp index 844e60fc826..c0dc01cd728 100644 --- a/esphome/components/wifi/wifi_component.cpp +++ b/esphome/components/wifi/wifi_component.cpp @@ -767,9 +767,7 @@ void WiFiComponent::restart_adapter() { } void WiFiComponent::on_powerdown() { - // Leave the AP before a reboot or deep sleep, after teardown has let the - // API say goodbye: otherwise the AP still holds the association when the - // device comes back and the first connects can stall or fail. + // Leave the AP so it no longer holds the association when we come back. if (!this->is_connected()) return; ESP_LOGD(TAG, "Disconnecting before powerdown"); @@ -778,7 +776,7 @@ void WiFiComponent::on_powerdown() { #else this->wifi_disconnect_(); #endif - delay(100); // let the deauth go out before the reset + delay(100); // NOLINT: once per reboot or deep sleep, lets the deauth go out } void WiFiComponent::loop() { diff --git a/esphome/components/wifi/wifi_component_libretiny.cpp b/esphome/components/wifi/wifi_component_libretiny.cpp index d80ca3da4b6..4ad065edb05 100644 --- a/esphome/components/wifi/wifi_component_libretiny.cpp +++ b/esphome/components/wifi/wifi_component_libretiny.cpp @@ -791,9 +791,7 @@ network::IPAddress WiFiComponent::wifi_soft_ap_ip() { return {WiFi.softAPIP()}; #ifdef USE_LN882X void WiFiComponent::wifi_powerdown_disconnect_() { - // The SDK call directly: LibreTiny's WiFi.disconnect() also frees the SSID - // its event handlers read, which once hung a reboot until the watchdog. - wifi_sta_disconnect(); + wifi_sta_disconnect(); // not WiFi.disconnect(): it frees the SSID its event handlers read } #endif