6static const char *
const TAG =
"tuya.fan";
10 if (speed_id.has_value()) {
13 ESP_LOGV(TAG,
"MCU reported speed of: %d", datapoint.
value_enum);
14 if (datapoint.
value_enum >= this->speed_count_) {
15 ESP_LOGE(TAG,
"Speed has invalid value %d", datapoint.
value_enum);
21 ESP_LOGV(TAG,
"MCU reported speed of: %d", datapoint.
value_int);
29 if (switch_id.has_value()) {
31 ESP_LOGV(TAG,
"MCU reported switch is: %s", ONOFF(datapoint.
value_bool));
37 if (oscillation_id.has_value()) {
41 ESP_LOGV(TAG,
"MCU reported oscillation is: %s", ONOFF(datapoint.
value_bool));
49 if (direction_id.has_value()) {
51 ESP_LOGD(TAG,
"MCU reported reverse direction is: %s", ONOFF(datapoint.
value_bool));
60 restored->to_call(*this).perform();
65 LOG_FAN(
"",
"Tuya Fan",
this);
67 if (speed_dp_id.has_value()) {
68 ESP_LOGCONFIG(TAG,
" Speed has datapoint ID %u", *speed_dp_id);
71 if (switch_dp_id.has_value()) {
72 ESP_LOGCONFIG(TAG,
" Switch has datapoint ID %u", *switch_dp_id);
75 if (oscillation_dp_id.has_value()) {
76 ESP_LOGCONFIG(TAG,
" Oscillation has datapoint ID %u", *oscillation_dp_id);
79 if (direction_dp_id.has_value()) {
80 ESP_LOGCONFIG(TAG,
" Direction has datapoint ID %u", *direction_dp_id);
91 if (switch_id.has_value()) {
93 if (
state.has_value()) {
98 if (osc_id.has_value()) {
109 if (dir_id.has_value()) {
117 if (spd_id.has_value()) {
119 if (
speed.has_value()) {
FanDirection direction
The current direction of the fan.
bool oscillating
The current oscillation state of the fan.
bool state
The current on/off state of the fan.
int speed
The current fan speed level.
optional< FanRestoreState > restore_state_()
optional< uint8_t > speed_id_
void dump_config() override
TuyaDatapointType speed_type_
fan::FanTraits get_traits() override
optional< uint8_t > oscillation_id_
optional< uint8_t > switch_id_
optional< uint8_t > direction_id_
TuyaDatapointType oscillation_type_
void control(const fan::FanCall &call) override
void set_boolean_datapoint_value(uint8_t datapoint_id, bool value)
void set_enum_datapoint_value(uint8_t datapoint_id, uint8_t value)
void add_on_initialized_callback(F &&callback)
void register_listener(uint8_t datapoint_id, const std::function< void(TuyaDatapoint)> &func)
void set_integer_datapoint_value(uint8_t datapoint_id, uint32_t value)