ESPHome  2022.6.2
tuya_fan.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace tuya {
9 
10 class TuyaFan : public Component, public fan::Fan {
11  public:
12  TuyaFan(Tuya *parent, int speed_count) : parent_(parent), speed_count_(speed_count) {}
13  void setup() override;
14  void dump_config() override;
15  void set_speed_id(uint8_t speed_id) { this->speed_id_ = speed_id; }
16  void set_switch_id(uint8_t switch_id) { this->switch_id_ = switch_id; }
17  void set_oscillation_id(uint8_t oscillation_id) { this->oscillation_id_ = oscillation_id; }
18  void set_direction_id(uint8_t direction_id) { this->direction_id_ = direction_id; }
19 
20  fan::FanTraits get_traits() override;
21 
22  protected:
23  void control(const fan::FanCall &call) override;
24 
30  int speed_count_{};
31 };
32 
33 } // namespace tuya
34 } // namespace esphome
fan::FanTraits get_traits() override
Definition: tuya_fan.cpp:62
void set_switch_id(uint8_t switch_id)
Definition: tuya_fan.h:16
void set_speed_id(uint8_t speed_id)
Definition: tuya_fan.h:15
void set_direction_id(uint8_t direction_id)
Definition: tuya_fan.h:18
optional< uint8_t > switch_id_
Definition: tuya_fan.h:27
TuyaFan(Tuya *parent, int speed_count)
Definition: tuya_fan.h:12
void control(const fan::FanCall &call) override
Definition: tuya_fan.cpp:67
optional< uint8_t > oscillation_id_
Definition: tuya_fan.h:28
void setup() override
Definition: tuya_fan.cpp:9
void dump_config() override
Definition: tuya_fan.cpp:50
Definition: a4988.cpp:4
optional< uint8_t > direction_id_
Definition: tuya_fan.h:29
optional< uint8_t > speed_id_
Definition: tuya_fan.h:26
void set_oscillation_id(uint8_t oscillation_id)
Definition: tuya_fan.h:17