From 23a2e4c92ddd497951b0097abbf59bb0c8945339 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 26 Feb 2026 11:41:29 -1000 Subject: [PATCH] [wifi] Restore original CYW43 STA mode setup in wifi_mode_ Restore the cyw43_wifi_set_up() call for STA mode that was incorrectly removed. Without this, cyw43_wifi_scan() fails on initial boot because the radio isn't initialized - scanning must work before the first beginNoBlock() call. --- esphome/components/wifi/wifi_component_pico_w.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esphome/components/wifi/wifi_component_pico_w.cpp b/esphome/components/wifi/wifi_component_pico_w.cpp index b67d689e3aa..9b2c077dc5e 100644 --- a/esphome/components/wifi/wifi_component_pico_w.cpp +++ b/esphome/components/wifi/wifi_component_pico_w.cpp @@ -24,10 +24,10 @@ static bool s_sta_had_ip = false; // NOLINT(cppcoreguidelines-avoid-non- static size_t s_scan_result_count = 0; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) bool WiFiComponent::wifi_mode_(optional sta, optional ap) { - if (sta.has_value() && sta.value()) { - // Enable STA mode so scanning works before the first beginNoBlock() call. - // Without this, cyw43_wifi_scan() fails because the radio isn't initialized. - cyw43_arch_enable_sta_mode(); + if (sta.has_value()) { + if (sta.value()) { + cyw43_wifi_set_up(&cyw43_state, CYW43_ITF_STA, true, CYW43_COUNTRY_WORLDWIDE); + } } bool ap_state = false;