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_);
73 ESP_LOGV(TAG,
"MCU reported eco is: %s", ONOFF(this->
eco_));
82 ESP_LOGV(TAG,
"MCU reported sleep is: %s", ONOFF(this->
sleep_));
91 ESP_LOGV(TAG,
"MCU reported vertical swing is: %s", ONOFF(datapoint.
value_bool));
100 ESP_LOGV(TAG,
"MCU reported horizontal swing is: %s", ONOFF(datapoint.
value_bool));
108 ESP_LOGV(TAG,
"MCU reported Fan Speed Mode is: %u", datapoint.
value_enum);
117 bool state_changed =
false;
121 ESP_LOGV(TAG,
"Heating state pin changed to: %s", ONOFF(heating_state));
123 state_changed =
true;
129 ESP_LOGV(TAG,
"Cooling state pin changed to: %s", ONOFF(cooling_state));
131 state_changed =
true;
142 if (
call.get_mode().has_value()) {
144 ESP_LOGV(TAG,
"Setting switch: %s", ONOFF(switch_state));
159 ESP_LOGW(TAG,
"Active state (mode) datapoint not configured");
166 if (
call.get_target_temperature().has_value()) {
180 ESP_LOGV(TAG,
"Setting eco: %s", ONOFF(eco));
189 ESP_LOGV(TAG,
"Setting sleep: %s", ONOFF(sleep));
196 bool vertical_swing_changed =
false;
197 bool horizontal_swing_changed =
false;
199 if (
call.get_swing_mode().has_value()) {
207 vertical_swing_changed =
true;
208 horizontal_swing_changed =
true;
216 vertical_swing_changed =
true;
217 horizontal_swing_changed =
true;
225 vertical_swing_changed =
true;
226 horizontal_swing_changed =
true;
234 vertical_swing_changed =
true;
235 horizontal_swing_changed =
true;
259 if (
call.get_fan_mode().has_value()) {
262 uint8_t tuya_fan_speed;
339 LOG_CLIMATE(
"",
"Tuya Climate",
this);
341 ESP_LOGCONFIG(TAG,
" Switch has datapoint ID %u", *this->
switch_id_);
344 ESP_LOGCONFIG(TAG,
" Active state has datapoint ID %u", *this->
active_state_id_);
355 ESP_LOGCONFIG(TAG,
" Eco has datapoint ID %u", *this->
eco_id_);
358 ESP_LOGCONFIG(TAG,
" Sleep has datapoint ID %u", *this->
sleep_id_);
371 }
else if (this->
sleep_) {
440 this->active_state_ == this->active_state_heating_value_) {
443 this->active_state_ == this->active_state_cooling_value_) {
446 this->active_state_ == this->active_state_drying_value_) {
449 this->active_state_ == this->active_state_fanonly_value_) {
456 this->active_state_ == this->active_state_heating_value_) {
460 this->active_state_ == this->active_state_cooling_value_) {
464 this->active_state_ == this->active_state_drying_value_) {
468 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.
void add_feature_flags(uint32_t feature_flags)
void add_supported_fan_mode(ClimateFanMode mode)
void add_supported_preset(ClimatePreset preset)
void set_supported_swing_modes(ClimateSwingModeMask modes)
void add_supported_mode(ClimateMode mode)
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
TuyaDatapointType eco_type_
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)
@ CLIMATE_SUPPORTS_CURRENT_TEMPERATURE
@ CLIMATE_SUPPORTS_ACTION
ClimatePreset
Enum for all preset modes NOTE: If adding values, update ClimatePresetMask in climate_traits....
@ 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.
ClimateFanMode
NOTE: If adding values, update ClimateFanModeMask in climate_traits.h to use the new last value.
@ 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.