ESPHome 2025.5.0
Loading...
Searching...
No Matches
tuya_climate.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome {
8namespace tuya {
9
10class TuyaClimate : public climate::Climate, public Component {
11 public:
12 void setup() override;
13 void loop() override;
14 void dump_config() override;
15 void set_supports_heat(bool supports_heat) { this->supports_heat_ = supports_heat; }
16 void set_supports_cool(bool supports_cool) { this->supports_cool_ = supports_cool; }
17 void set_switch_id(uint8_t switch_id) { this->switch_id_ = switch_id; }
18 void set_active_state_id(uint8_t state_id) { this->active_state_id_ = state_id; }
19 void set_active_state_heating_value(uint8_t value) { this->active_state_heating_value_ = value; }
20 void set_active_state_cooling_value(uint8_t value) { this->active_state_cooling_value_ = value; }
21 void set_active_state_drying_value(uint8_t value) { this->active_state_drying_value_ = value; }
22 void set_active_state_fanonly_value(uint8_t value) { this->active_state_fanonly_value_ = value; }
25 void set_swing_vertical_id(uint8_t swing_vertical_id) { this->swing_vertical_id_ = swing_vertical_id; }
26 void set_swing_horizontal_id(uint8_t swing_horizontal_id) { this->swing_horizontal_id_ = swing_horizontal_id; }
27 void set_fan_speed_id(uint8_t fan_speed_id) { this->fan_speed_id_ = fan_speed_id; }
28 void set_fan_speed_low_value(uint8_t fan_speed_low_value) { this->fan_speed_low_value_ = fan_speed_low_value; }
29 void set_fan_speed_medium_value(uint8_t fan_speed_medium_value) {
30 this->fan_speed_medium_value_ = fan_speed_medium_value;
31 }
32 void set_fan_speed_middle_value(uint8_t fan_speed_middle_value) {
33 this->fan_speed_middle_value_ = fan_speed_middle_value;
34 }
35 void set_fan_speed_high_value(uint8_t fan_speed_high_value) { this->fan_speed_high_value_ = fan_speed_high_value; }
36 void set_fan_speed_auto_value(uint8_t fan_speed_auto_value) { this->fan_speed_auto_value_ = fan_speed_auto_value; }
37 void set_target_temperature_id(uint8_t target_temperature_id) {
38 this->target_temperature_id_ = target_temperature_id;
39 }
40 void set_current_temperature_id(uint8_t current_temperature_id) {
41 this->current_temperature_id_ = current_temperature_id;
42 }
43 void set_current_temperature_multiplier(float temperature_multiplier) {
44 this->current_temperature_multiplier_ = temperature_multiplier;
45 }
46 void set_target_temperature_multiplier(float temperature_multiplier) {
47 this->target_temperature_multiplier_ = temperature_multiplier;
48 }
49 void set_eco_id(uint8_t eco_id) { this->eco_id_ = eco_id; }
50 void set_eco_temperature(float eco_temperature) { this->eco_temperature_ = eco_temperature; }
51 void set_sleep_id(uint8_t sleep_id) { this->sleep_id_ = sleep_id; }
52
54
55 void set_tuya_parent(Tuya *parent) { this->parent_ = parent; }
56
57 protected:
59 void control(const climate::ClimateCall &call) override;
60
63
66
69
71 void compute_preset_();
72
75
77 void compute_state_();
78
80 void compute_swingmode_();
81
83 void compute_fanmode_();
84
87
103 float hysteresis_{1.0f};
108 uint8_t fan_state_;
117 bool swing_vertical_{false};
118 bool swing_horizontal_{false};
119 bool heating_state_{false};
120 bool cooling_state_{false};
122 bool eco_;
123 bool sleep_;
125};
126
127} // namespace tuya
128} // namespace esphome
This class is used to encode all control actions on a climate device.
Definition climate.h:33
ClimateDevice - This is the base class for all climate integrations.
Definition climate.h:168
ClimateAction action
The active state of the climate device.
Definition climate.h:176
This class contains all static data for climate devices.
optional< uint8_t > fan_speed_high_value_
void set_active_state_cooling_value(uint8_t value)
void set_tuya_parent(Tuya *parent)
void set_supports_cool(bool supports_cool)
void set_swing_horizontal_id(uint8_t swing_horizontal_id)
void set_swing_vertical_id(uint8_t swing_vertical_id)
void switch_to_action_(climate::ClimateAction action)
Switch the climate device to the given climate mode.
void set_fan_speed_high_value(uint8_t fan_speed_high_value)
void set_cooling_state_pin(GPIOPin *pin)
void set_current_temperature_multiplier(float temperature_multiplier)
optional< uint8_t > swing_vertical_id_
void set_fan_speed_middle_value(uint8_t fan_speed_middle_value)
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_
void set_fan_speed_low_value(uint8_t fan_speed_low_value)
void control_fan_mode_(const climate::ClimateCall &call)
Override control to change settings of fan mode.
void set_switch_id(uint8_t switch_id)
void set_sleep_id(uint8_t sleep_id)
void compute_target_temperature_()
Re-compute the target temperature of this climate controller.
void set_current_temperature_id(uint8_t current_temperature_id)
optional< uint8_t > active_state_id_
void set_active_state_drying_value(uint8_t value)
void set_active_state_heating_value(uint8_t value)
optional< uint8_t > fan_speed_auto_value_
void compute_swingmode_()
Re-Compute the swing mode of this climate controller.
void set_eco_id(uint8_t eco_id)
void set_target_temperature_id(uint8_t target_temperature_id)
void compute_preset_()
Re-compute the active preset of this climate controller.
optional< uint8_t > swing_horizontal_id_
void set_fan_speed_id(uint8_t fan_speed_id)
optional< float > eco_temperature_
optional< uint8_t > active_state_fanonly_value_
optional< uint8_t > fan_speed_medium_value_
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_
void set_fan_speed_medium_value(uint8_t fan_speed_medium_value)
optional< uint8_t > active_state_cooling_value_
void set_heating_state_pin(GPIOPin *pin)
optional< uint8_t > active_state_drying_value_
climate::ClimateTraits traits() override
Return the traits of this controller.
void set_active_state_fanonly_value(uint8_t value)
void set_active_state_id(uint8_t state_id)
optional< uint8_t > fan_speed_id_
optional< uint8_t > active_state_heating_value_
void set_fan_speed_auto_value(uint8_t fan_speed_auto_value)
optional< uint8_t > target_temperature_id_
void control(const climate::ClimateCall &call) override
Override control to change settings of the climate device.
void set_supports_heat(bool supports_heat)
void set_target_temperature_multiplier(float temperature_multiplier)
optional< uint8_t > eco_id_
optional< uint8_t > switch_id_
void set_eco_temperature(float eco_temperature)
ClimateAction
Enum for the current action of the climate device. Values match those of ClimateMode.
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7