From d6528f906ebd73db248845a86e3cad2d1a1340f9 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 6 Nov 2025 17:49:45 -0600 Subject: [PATCH] dry --- esphome/components/wifi/wifi_component.cpp | 4 ---- esphome/components/wifi/wifi_component.h | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/esphome/components/wifi/wifi_component.cpp b/esphome/components/wifi/wifi_component.cpp index 4a76603691..a47cba169a 100644 --- a/esphome/components/wifi/wifi_component.cpp +++ b/esphome/components/wifi/wifi_component.cpp @@ -343,10 +343,6 @@ void WiFiComponent::set_sta(const WiFiAP &ap) { this->add_sta(ap); this->selected_sta_index_ = 0; } -void WiFiComponent::clear_sta() { - this->sta_.clear(); - this->selected_sta_index_ = -1; -} WiFiAP WiFiComponent::build_wifi_ap_from_selected_() const { // PRECONDITION: selected_sta_index_ must be valid (ensured by all callers) diff --git a/esphome/components/wifi/wifi_component.h b/esphome/components/wifi/wifi_component.h index a457ae6bd9..394f00fd57 100644 --- a/esphome/components/wifi/wifi_component.h +++ b/esphome/components/wifi/wifi_component.h @@ -222,7 +222,10 @@ class WiFiComponent : public Component { WiFiAP get_sta() const; void init_sta(size_t count); void add_sta(const WiFiAP &ap); - void clear_sta(); + void clear_sta() { + this->sta_.clear(); + this->selected_sta_index_ = -1; + } #ifdef USE_WIFI_AP /** Setup an Access Point that should be created if no connection to a station can be made.