ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
template_fan.h
Go to the documentation of this file.
1#pragma once
2
5
6namespace esphome::template_ {
7
8class TemplateFan final : public Component, public fan::Fan {
9 public:
11 void setup() override;
12 void dump_config() override;
13 void set_has_direction(bool has_direction) { this->has_direction_ = has_direction; }
14 void set_has_oscillating(bool has_oscillating) { this->has_oscillating_ = has_oscillating; }
15 void set_speed_count(int count) { this->speed_count_ = count; }
16 // Remove before 2027.5.0
17 ESPDEPRECATED("Use set_supported_preset_modes() instead. Removed in 2027.5.0", "2026.11.0")
18 void set_preset_modes(std::initializer_list<const char *> presets) { this->set_supported_preset_modes(presets); }
20 this->wire_preset_modes_(this->traits_);
21 return this->traits_;
22 }
23
24 protected:
25 void control(const fan::FanCall &call) override;
26
27 bool has_oscillating_{false};
28 bool has_direction_{false};
31};
32
33} // namespace esphome::template_
void set_supported_preset_modes(std::initializer_list< const char * > preset_modes)
Set the supported preset modes; the list is copied (stored on Fan, referenced by FanTraits).
Definition fan.h:134
void wire_preset_modes_(FanTraits &traits)
Wire the Fan-owned preset modes pointer into the given traits object.
Definition fan.h:186
void control(const fan::FanCall &call) override
void set_has_direction(bool has_direction)
void set_has_oscillating(bool has_oscillating)
fan::FanTraits get_traits() override
ESPDEPRECATED("Use set_supported_preset_modes() instead. Removed in 2027.5.0", "2026.11.0") void set_preset_modes(std
unsigned count
Definition gif.cpp:51
STL namespace.