7 static const char *
const TAG =
"tuya.climate";
12 ESP_LOGV(TAG,
"MCU reported switch is: %s", ONOFF(datapoint.
value_bool));
37 ESP_LOGV(TAG,
"MCU reported active state is: %u", datapoint.
value_enum);
50 ESP_LOGV(TAG,
"MCU reported manual target temperature is: %.1f", this->
manual_temperature_);
71 ESP_LOGV(TAG,
"MCU reported eco is: %s", ONOFF(this->
eco_));
80 ESP_LOGV(TAG,
"MCU reported sleep is: %s", ONOFF(this->
sleep_));
89 ESP_LOGV(TAG,
"MCU reported vertical swing is: %s", ONOFF(datapoint.
value_bool));
98 ESP_LOGV(TAG,
"MCU reported horizontal swing is: %s", ONOFF(datapoint.
value_bool));
106 ESP_LOGV(TAG,
"MCU reported Fan Speed Mode is: %u", datapoint.
value_enum);
115 bool state_changed =
false;
119 ESP_LOGV(TAG,
"Heating state pin changed to: %s", ONOFF(heating_state));
121 state_changed =
true;
127 ESP_LOGV(TAG,
"Cooling state pin changed to: %s", ONOFF(cooling_state));
129 state_changed =
true;
142 ESP_LOGV(TAG,
"Setting switch: %s", ONOFF(switch_state));
157 ESP_LOGW(TAG,
"Active state (mode) datapoint not configured");
167 target_temperature = (target_temperature * 9 / 5) + 32;
169 ESP_LOGV(TAG,
"Setting target temperature: %.1f", target_temperature);
178 ESP_LOGV(TAG,
"Setting eco: %s", ONOFF(eco));
183 ESP_LOGV(TAG,
"Setting sleep: %s", ONOFF(sleep));
190 bool vertical_swing_changed =
false;
191 bool horizontal_swing_changed =
false;
201 vertical_swing_changed =
true;
202 horizontal_swing_changed =
true;
210 vertical_swing_changed =
true;
211 horizontal_swing_changed =
true;
219 vertical_swing_changed =
true;
220 horizontal_swing_changed =
true;
228 vertical_swing_changed =
true;
229 horizontal_swing_changed =
true;
256 uint8_t tuya_fan_speed;
306 std::set<climate::ClimateSwingMode> supported_swing_modes = {
336 LOG_CLIMATE(
"",
"Tuya Climate",
this);
338 ESP_LOGCONFIG(TAG,
" Switch has datapoint ID %u", *this->
switch_id_);
341 ESP_LOGCONFIG(TAG,
" Active state has datapoint ID %u", *this->
active_state_id_);
352 ESP_LOGCONFIG(TAG,
" Eco has datapoint ID %u", *this->
eco_id_);
355 ESP_LOGCONFIG(TAG,
" Sleep has datapoint ID %u", *this->
sleep_id_);
368 }
else if (this->
sleep_) {
This class is used to encode all control actions on a climate device.
The fan mode is set to Low.
The climate device is off (inactive or no power)
ClimateSwingMode swing_mode
The active swing mode of the climate device.
GPIOPin * heating_state_pin_
optional< uint8_t > sleep_id_
void set_enum_datapoint_value(uint8_t datapoint_id, uint8_t value)
The fan mode is set to Both.
optional< uint8_t > fan_speed_low_value_
optional< uint8_t > swing_vertical_id_
The climate device is drying.
ClimatePreset
Enum for all preset modes.
float target_temperature
The target temperature of the climate device.
void switch_to_action_(climate::ClimateAction action)
Switch the climate device to the given climate mode.
The climate device is in fan only mode.
const optional< ClimateMode > & get_mode() const
The fan mode is set to Middle.
This class contains all static data for climate devices.
void control_fan_mode_(const climate::ClimateCall &call)
Override control to change settings of fan mode.
The climate device is set to heat to reach the target temperature.
optional< uint8_t > fan_speed_medium_value_
GPIOPin * cooling_state_pin_
ClimateMode mode
The active mode of the climate device.
float current_temperature_multiplier_
float current_temperature
The current temperature of the climate device, as reported from the integration.
optional< uint8_t > active_state_cooling_value_
float manual_temperature_
optional< uint8_t > swing_horizontal_id_
void register_listener(uint8_t datapoint_id, const std::function< void(TuyaDatapoint)> &func)
The climate device is set to dry/humidity mode.
optional< uint8_t > switch_id_
void add_supported_preset(ClimatePreset preset)
Device is prepared for sleep.
void compute_swingmode_()
Re-Compute the swing mode of this climate controller.
optional< uint8_t > fan_speed_auto_value_
optional< uint8_t > active_state_drying_value_
void compute_target_temperature_()
Re-compute the target temperature of this climate controller.
The fan mode is set to Horizontal.
The climate device is set to cool to reach the target temperature.
void dump_config() override
const optional< ClimatePreset > & get_preset() const
void compute_fanmode_()
Re-Compute the fan mode of this climate controller.
The fan mode is set to Auto.
void control(const climate::ClimateCall &call) override
Override control to change settings of the climate device.
optional< ClimatePreset > preset
The active preset of the climate device.
optional< uint8_t > active_state_fanonly_value_
optional< uint8_t > active_state_id_
optional< uint8_t > eco_id_
ClimateAction
Enum for the current action of the climate device. Values match those of ClimateMode.
optional< float > eco_temperature_
The climate device is set to heat/cool to reach the target temperature.
The fan mode is set to Vertical.
The climate device is actively heating.
void add_supported_fan_mode(ClimateFanMode mode)
optional< uint8_t > fan_speed_middle_value_
optional< uint8_t > fan_speed_high_value_
const optional< float > & get_target_temperature() const
optional< uint8_t > active_state_heating_value_
void publish_state()
Publish the state of the climate device, to be called from integrations.
virtual bool digital_read()=0
The fan mode is set to High.
ClimateMode
Enum for all modes a climate device can be in.
The swing mode is set to Off.
The climate device is off.
void set_supports_action(bool supports_action)
climate::ClimateTraits traits() override
Return the traits of this controller.
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
void set_boolean_datapoint_value(uint8_t datapoint_id, bool value)
const optional< ClimateFanMode > & get_fan_mode() const
void set_integer_datapoint_value(uint8_t datapoint_id, uint32_t value)
const optional< ClimateSwingMode > & get_swing_mode() const
Implementation of SPI Controller mode.
optional< uint8_t > fan_speed_id_
void set_supported_swing_modes(std::set< ClimateSwingMode > modes)
The climate device is idle (monitoring climate but no action needed)
Device is running an energy-saving preset.
void set_supports_current_temperature(bool supports_current_temperature)
void compute_state_()
Re-compute the state of this climate controller.
optional< uint8_t > target_temperature_id_
The fan mode is set to Medium.
void control_swing_mode_(const climate::ClimateCall &call)
Override control to change settings of swing mode.
The climate device only has the fan enabled, no heating or cooling is taking place.
The climate device is actively cooling.
void add_supported_mode(ClimateMode mode)
float target_temperature_multiplier_
void compute_preset_()
Re-compute the active preset of this climate controller.
optional< uint8_t > current_temperature_id_
ClimateAction action
The active state of the climate device.