7static 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;
140 if (
call.get_mode().has_value()) {
142 ESP_LOGV(TAG,
"Setting switch: %s", ONOFF(switch_state));
157 ESP_LOGW(TAG,
"Active state (mode) datapoint not configured");
164 if (
call.get_target_temperature().has_value()) {
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;
193 if (
call.get_swing_mode().has_value()) {
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;
253 if (
call.get_fan_mode().has_value()) {
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_) {
437 this->active_state_ == this->active_state_heating_value_) {
440 this->active_state_ == this->active_state_cooling_value_) {
443 this->active_state_ == this->active_state_drying_value_) {
446 this->active_state_ == this->active_state_fanonly_value_) {
453 this->active_state_ == this->active_state_heating_value_) {
457 this->active_state_ == this->active_state_cooling_value_) {
461 this->active_state_ == this->active_state_drying_value_) {
465 this->active_state_ == this->active_state_fanonly_value_) {
virtual bool digital_read()=0
This class is used to encode all control actions on a climate device.
const optional< ClimatePreset > & get_preset() const
ClimateMode mode
The active mode of the climate device.
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
float target_temperature
The target temperature of the climate device.
ClimateSwingMode swing_mode
The active swing mode of the climate device.
float current_temperature
The current temperature of the climate device, as reported from the integration.
ClimateAction action
The active state of the climate device.
void publish_state()
Publish the state of the climate device, to be called from integrations.
optional< ClimatePreset > preset
The active preset of the climate device.
This class contains all static data for climate devices.
void add_supported_fan_mode(ClimateFanMode mode)
void set_supports_action(bool supports_action)
void add_supported_preset(ClimatePreset preset)
void set_supported_swing_modes(std::set< ClimateSwingMode > modes)
void add_supported_mode(ClimateMode mode)
void set_supports_current_temperature(bool supports_current_temperature)
optional< uint8_t > fan_speed_high_value_
float target_temperature_multiplier_
GPIOPin * heating_state_pin_
void switch_to_action_(climate::ClimateAction action)
Switch the climate device to the given climate mode.
optional< uint8_t > swing_vertical_id_
void compute_fanmode_()
Re-Compute the fan mode of this climate controller.
optional< uint8_t > fan_speed_low_value_
optional< uint8_t > current_temperature_id_
float current_temperature_multiplier_
void control_fan_mode_(const climate::ClimateCall &call)
Override control to change settings of fan mode.
void compute_target_temperature_()
Re-compute the target temperature of this climate controller.
optional< uint8_t > active_state_id_
optional< uint8_t > fan_speed_auto_value_
void compute_swingmode_()
Re-Compute the swing mode of this climate controller.
void dump_config() override
void compute_preset_()
Re-compute the active preset of this climate controller.
optional< uint8_t > swing_horizontal_id_
GPIOPin * cooling_state_pin_
optional< float > eco_temperature_
optional< uint8_t > active_state_fanonly_value_
optional< uint8_t > fan_speed_medium_value_
float manual_temperature_
void control_swing_mode_(const climate::ClimateCall &call)
Override control to change settings of swing mode.
optional< uint8_t > sleep_id_
void compute_state_()
Re-compute the state of this climate controller.
optional< uint8_t > fan_speed_middle_value_
optional< uint8_t > active_state_cooling_value_
optional< uint8_t > active_state_drying_value_
climate::ClimateTraits traits() override
Return the traits of this controller.
optional< uint8_t > fan_speed_id_
optional< uint8_t > active_state_heating_value_
optional< uint8_t > target_temperature_id_
void control(const climate::ClimateCall &call) override
Override control to change settings of the climate device.
optional< uint8_t > eco_id_
optional< uint8_t > switch_id_
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)
ClimatePreset
Enum for all preset modes.
@ CLIMATE_PRESET_NONE
No preset is active.
@ CLIMATE_PRESET_SLEEP
Device is prepared for sleep.
@ CLIMATE_PRESET_ECO
Device is running an energy-saving preset.
@ CLIMATE_SWING_OFF
The swing mode is set to Off.
@ CLIMATE_SWING_HORIZONTAL
The fan mode is set to Horizontal.
@ CLIMATE_SWING_VERTICAL
The fan mode is set to Vertical.
@ CLIMATE_SWING_BOTH
The fan mode is set to Both.
ClimateMode
Enum for all modes a climate device can be in.
@ CLIMATE_MODE_DRY
The climate device is set to dry/humidity mode.
@ CLIMATE_MODE_FAN_ONLY
The climate device only has the fan enabled, no heating or cooling is taking place.
@ CLIMATE_MODE_HEAT
The climate device is set to heat to reach the target temperature.
@ CLIMATE_MODE_COOL
The climate device is set to cool to reach the target temperature.
@ CLIMATE_MODE_HEAT_COOL
The climate device is set to heat/cool to reach the target temperature.
@ CLIMATE_MODE_OFF
The climate device is off.
ClimateAction
Enum for the current action of the climate device. Values match those of ClimateMode.
@ CLIMATE_ACTION_OFF
The climate device is off (inactive or no power)
@ CLIMATE_ACTION_IDLE
The climate device is idle (monitoring climate but no action needed)
@ CLIMATE_ACTION_DRYING
The climate device is drying.
@ CLIMATE_ACTION_HEATING
The climate device is actively heating.
@ CLIMATE_ACTION_COOLING
The climate device is actively cooling.
@ CLIMATE_ACTION_FAN
The climate device is in fan only mode.
@ CLIMATE_FAN_MEDIUM
The fan mode is set to Medium.
@ CLIMATE_FAN_AUTO
The fan mode is set to Auto.
@ CLIMATE_FAN_LOW
The fan mode is set to Low.
@ CLIMATE_FAN_MIDDLE
The fan mode is set to Middle.
@ CLIMATE_FAN_HIGH
The fan mode is set to High.
Providing packet encoding functions for exchanging data with a remote host.