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