ESPHome  2024.11.1
speed_fan.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <set>
4 
9 
10 namespace esphome {
11 namespace speed {
12 
13 class SpeedFan : public Component, public fan::Fan {
14  public:
15  SpeedFan(int speed_count) : speed_count_(speed_count) {}
16  void setup() override;
17  void dump_config() override;
18  void set_output(output::FloatOutput *output) { this->output_ = output; }
21  void set_preset_modes(const std::set<std::string> &presets) { this->preset_modes_ = presets; }
22  fan::FanTraits get_traits() override { return this->traits_; }
23 
24  protected:
25  void control(const fan::FanCall &call) override;
26  void write_state_();
27 
31  int speed_count_{};
33  std::set<std::string> preset_modes_{};
34 };
35 
36 } // namespace speed
37 } // namespace esphome
bool oscillating
The current oscillation state of the fan.
Definition: fan.h:112
FanDirection direction
The current direction of the fan.
Definition: fan.h:116
void set_direction(output::BinaryOutput *direction)
Definition: speed_fan.h:20
Base class for all output components that can output a variable level, like PWM.
Definition: float_output.h:31
void dump_config() override
Definition: speed_fan.cpp:21
output::FloatOutput * output_
Definition: speed_fan.h:28
int speed
Definition: fan.h:35
void control(const fan::FanCall &call) override
Definition: speed_fan.cpp:23
void set_preset_modes(const std::set< std::string > &presets)
Definition: speed_fan.h:21
fan::FanTraits get_traits() override
Definition: speed_fan.h:22
fan::FanTraits traits_
Definition: speed_fan.h:32
std::set< std::string > preset_modes_
Definition: speed_fan.h:33
SpeedFan(int speed_count)
Definition: speed_fan.h:15
output::BinaryOutput * oscillating_
Definition: speed_fan.h:29
void setup() override
Definition: speed_fan.cpp:9
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_oscillating(output::BinaryOutput *oscillating)
Definition: speed_fan.h:19
void set_output(output::FloatOutput *output)
Definition: speed_fan.h:18
output::BinaryOutput * direction_
Definition: speed_fan.h:30