From 26e47546737b78287359b1ebbbd8c23529792b71 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 22 Oct 2025 12:02:20 -1000 Subject: [PATCH] fixed --- esphome/components/api/api_connection.cpp | 2 +- esphome/components/fan/fan_traits.h | 15 --------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index cb480ce51a..970b6d29f4 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -424,7 +424,7 @@ uint16_t APIConnection::try_send_fan_info(EntityBase *entity, APIConnection *con msg.supports_direction = traits.supports_direction(); msg.supported_speed_count = traits.supported_speed_count(); if (traits.supports_preset_modes()) - msg.supported_preset_modes = &traits.supported_preset_modes_for_api_(); + msg.supported_preset_modes = &traits.supported_preset_modes(); return fill_and_encode_entity_info(fan, msg, ListEntitiesFanResponse::MESSAGE_TYPE, conn, remaining_size, is_single); } void APIConnection::fan_command(const FanCommandRequest &msg) { diff --git a/esphome/components/fan/fan_traits.h b/esphome/components/fan/fan_traits.h index 138d39bb65..5c2a0eb355 100644 --- a/esphome/components/fan/fan_traits.h +++ b/esphome/components/fan/fan_traits.h @@ -3,13 +3,6 @@ #include "esphome/core/helpers.h" namespace esphome { - -#ifdef USE_API -namespace api { -class APIConnection; -} // namespace api -#endif - namespace fan { class FanTraits { @@ -48,14 +41,6 @@ class FanTraits { bool supports_preset_modes() const { return this->preset_modes_ != nullptr && !this->preset_modes_->empty(); } protected: -#ifdef USE_API - friend class api::APIConnection; - // This method returns a reference to the internal preset modes. - // It is used by the API to avoid copying data when encoding messages. - // Warning: Do not use this method outside of the API connection code. - // It returns a reference to internal data that can be invalidated. - const FixedVector &supported_preset_modes_for_api_() const { return *this->preset_modes_; } -#endif bool oscillation_{false}; bool speed_{false}; bool direction_{false};