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;