7static const char *
const TAG =
"tuya.fan";
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);
30 ESP_LOGV(TAG,
"MCU reported switch is: %s", ONOFF(datapoint.
value_bool));
39 ESP_LOGV(TAG,
"MCU reported oscillation is: %s", ONOFF(datapoint.
value_bool));
48 ESP_LOGD(TAG,
"MCU reported reverse direction is: %s", ONOFF(datapoint.
value_bool));
57 restored->to_call(*this).perform();
62 LOG_FAN(
"",
"Tuya Fan",
this);
64 ESP_LOGCONFIG(TAG,
" Speed has datapoint ID %u", *this->
speed_id_);
67 ESP_LOGCONFIG(TAG,
" Switch has datapoint ID %u", *this->
switch_id_);
70 ESP_LOGCONFIG(TAG,
" Oscillation has datapoint ID %u", *this->
oscillation_id_);
73 ESP_LOGCONFIG(TAG,
" Direction has datapoint ID %u", *this->
direction_id_);
optional< bool > get_state() const
optional< bool > get_oscillating() const
optional< int > get_speed() const
optional< FanDirection > get_direction() const
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 add_on_initialized_callback(std::function< void()> callback)
void set_boolean_datapoint_value(uint8_t datapoint_id, bool value)
void set_enum_datapoint_value(uint8_t datapoint_id, uint8_t value)
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)
Providing packet encoding functions for exchanging data with a remote host.