7static const char *
const TAG =
"tuya.fan";
11 if (speed_id.has_value()) {
14 ESP_LOGV(TAG,
"MCU reported speed of: %d", datapoint.
value_enum);
15 if (datapoint.
value_enum >= this->speed_count_) {
16 ESP_LOGE(TAG,
"Speed has invalid value %d", datapoint.
value_enum);
22 ESP_LOGV(TAG,
"MCU reported speed of: %d", datapoint.
value_int);
30 if (switch_id.has_value()) {
32 ESP_LOGV(TAG,
"MCU reported switch is: %s", ONOFF(datapoint.
value_bool));
38 if (oscillation_id.has_value()) {
42 ESP_LOGV(TAG,
"MCU reported oscillation is: %s", ONOFF(datapoint.
value_bool));
50 if (direction_id.has_value()) {
52 ESP_LOGD(TAG,
"MCU reported reverse direction is: %s", ONOFF(datapoint.
value_bool));
61 restored->to_call(*this).perform();
66 LOG_FAN(
"",
"Tuya Fan",
this);
68 if (speed_dp_id.has_value()) {
69 ESP_LOGCONFIG(TAG,
" Speed has datapoint ID %u", *speed_dp_id);
72 if (switch_dp_id.has_value()) {
73 ESP_LOGCONFIG(TAG,
" Switch has datapoint ID %u", *switch_dp_id);
76 if (oscillation_dp_id.has_value()) {
77 ESP_LOGCONFIG(TAG,
" Oscillation has datapoint ID %u", *oscillation_dp_id);
80 if (direction_dp_id.has_value()) {
81 ESP_LOGCONFIG(TAG,
" Direction has datapoint ID %u", *direction_dp_id);
92 if (switch_id.has_value()) {
94 if (
state.has_value()) {
99 if (osc_id.has_value()) {
110 if (dir_id.has_value()) {
118 if (spd_id.has_value()) {
120 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 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.