ESPHome  2021.11.3
tuya_climate.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace tuya {
9 
10 class 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_heating_state_pin(GPIOPin *pin) { this->heating_state_pin_ = pin; }
22  void set_cooling_state_pin(GPIOPin *pin) { this->cooling_state_pin_ = pin; }
23  void set_target_temperature_id(uint8_t target_temperature_id) {
24  this->target_temperature_id_ = target_temperature_id;
25  }
26  void set_current_temperature_id(uint8_t current_temperature_id) {
27  this->current_temperature_id_ = current_temperature_id;
28  }
29  void set_current_temperature_multiplier(float temperature_multiplier) {
30  this->current_temperature_multiplier_ = temperature_multiplier;
31  }
32  void set_target_temperature_multiplier(float temperature_multiplier) {
33  this->target_temperature_multiplier_ = temperature_multiplier;
34  }
35  void set_eco_id(uint8_t eco_id) { this->eco_id_ = eco_id; }
36  void set_eco_temperature(float eco_temperature) { this->eco_temperature_ = eco_temperature; }
37 
38  void set_tuya_parent(Tuya *parent) { this->parent_ = parent; }
39 
40  protected:
42  void control(const climate::ClimateCall &call) override;
43 
45  climate::ClimateTraits traits() override;
46 
48  void compute_preset_();
49 
52 
54  void compute_state_();
55 
58 
72  float hysteresis_{1.0f};
75  uint8_t active_state_;
76  bool heating_state_{false};
77  bool cooling_state_{false};
79  bool eco_;
80 };
81 
82 } // namespace tuya
83 } // namespace esphome
This class is used to encode all control actions on a climate device.
Definition: climate.h:33
void switch_to_action_(climate::ClimateAction action)
Switch the climate device to the given climate mode.
This class contains all static data for climate devices.
void set_current_temperature_id(uint8_t current_temperature_id)
Definition: tuya_climate.h:26
void set_tuya_parent(Tuya *parent)
Definition: tuya_climate.h:38
optional< uint8_t > active_state_cooling_value_
Definition: tuya_climate.h:65
void set_active_state_cooling_value(uint8_t value)
Definition: tuya_climate.h:20
void set_eco_temperature(float eco_temperature)
Definition: tuya_climate.h:36
void set_target_temperature_multiplier(float temperature_multiplier)
Definition: tuya_climate.h:32
void set_supports_cool(bool supports_cool)
Definition: tuya_climate.h:16
optional< uint8_t > switch_id_
Definition: tuya_climate.h:62
void compute_target_temperature_()
Re-compute the target temperature of this climate controller.
void set_supports_heat(bool supports_heat)
Definition: tuya_climate.h:15
void set_switch_id(uint8_t switch_id)
Definition: tuya_climate.h:17
void control(const climate::ClimateCall &call) override
Override control to change settings of the climate device.
optional< uint8_t > active_state_id_
Definition: tuya_climate.h:63
optional< uint8_t > eco_id_
Definition: tuya_climate.h:73
ClimateAction
Enum for the current action of the climate device. Values match those of ClimateMode.
Definition: climate_mode.h:31
optional< float > eco_temperature_
Definition: tuya_climate.h:74
void set_active_state_id(uint8_t state_id)
Definition: tuya_climate.h:18
void set_heating_state_pin(GPIOPin *pin)
Definition: tuya_climate.h:21
void set_current_temperature_multiplier(float temperature_multiplier)
Definition: tuya_climate.h:29
optional< uint8_t > active_state_heating_value_
Definition: tuya_climate.h:64
climate::ClimateTraits traits() override
Return the traits of this controller.
void set_target_temperature_id(uint8_t target_temperature_id)
Definition: tuya_climate.h:23
void set_active_state_heating_value(uint8_t value)
Definition: tuya_climate.h:19
void set_cooling_state_pin(GPIOPin *pin)
Definition: tuya_climate.h:22
Library based on https://github.com/miguelbalboa/rfid and adapted to ESPHome by . ...
Definition: a4988.cpp:4
void compute_state_()
Re-compute the state of this climate controller.
optional< uint8_t > target_temperature_id_
Definition: tuya_climate.h:68
void compute_preset_()
Re-compute the active preset of this climate controller.
optional< uint8_t > current_temperature_id_
Definition: tuya_climate.h:69
ClimateAction action
The active state of the climate device.
Definition: climate.h:177
ClimateDevice - This is the base class for all climate integrations.
Definition: climate.h:167
void set_eco_id(uint8_t eco_id)
Definition: tuya_climate.h:35