ESPHome  2024.3.1
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_{};
33 };
34 
35 } // namespace tuya
36 } // namespace esphome
fan::FanTraits get_traits() override
Definition: tuya_fan.cpp:77
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
TuyaDatapointType
Definition: tuya.h:19
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:82
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:61
TuyaDatapointType speed_type_
Definition: tuya_fan.h:31
TuyaDatapointType oscillation_type_
Definition: tuya_fan.h:32
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
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