From f34847a92c45595d68ec88531c6cb62c08816fc6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 4 Oct 2026 20:57:51 -0500 Subject: [PATCH] [wifi] Call the SDK disconnect directly before an LN882x reboot --- esphome/components/wifi/wifi_component_libretiny.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/components/wifi/wifi_component_libretiny.cpp b/esphome/components/wifi/wifi_component_libretiny.cpp index c8eaa46d7a6..66a0d406a7a 100644 --- a/esphome/components/wifi/wifi_component_libretiny.cpp +++ b/esphome/components/wifi/wifi_component_libretiny.cpp @@ -796,7 +796,9 @@ void WiFiComponent::on_shutdown() { if (!this->is_connected()) return; ESP_LOGD(TAG, "Disconnecting before reboot"); - this->wifi_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(); delay(100); // let the deauth go out before the reset } #endif