This commit is contained in:
J. Nick Koston
2025-10-22 12:02:20 -10:00
parent b0f764a37e
commit 26e4754673
2 changed files with 1 additions and 16 deletions
+1 -1
View File
@@ -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) {
-15
View File
@@ -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<std::string> &supported_preset_modes_for_api_() const { return *this->preset_modes_; }
#endif
bool oscillation_{false};
bool speed_{false};
bool direction_{false};