1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-29 22:24:26 +00:00
This commit is contained in:
J. Nick Koston
2025-10-22 11:38:52 -10:00
parent eaf0a367b4
commit 274c0505f7

View File

@@ -1,8 +1,7 @@
#include <utility>
#include "esphome/core/helpers.h"
#pragma once
#include "esphome/core/helpers.h"
namespace esphome {
#ifdef USE_API
@@ -43,14 +42,11 @@ class FanTraits {
void set_direction(bool direction) { this->direction_ = direction; }
/// Return the preset modes supported by the fan.
const FixedVector<std::string> &supported_preset_modes() const { return *this->preset_modes_; }
/// Set the preset modes pointer (points to parent Fan's preset_modes_)
void set_supported_preset_modes(const FixedVector<std::string> *preset_modes) { this->preset_modes_ = preset_modes; }
/// Return if preset modes are supported
bool supports_preset_modes() const { return !this->preset_modes_->empty(); }
protected:
#ifdef USE_API
// The API connection is a friend class to access internal methods
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.