ESPHome  2024.12.2
bang_bang_climate.h
Go to the documentation of this file.
1 #pragma once
2 
7 
8 namespace esphome {
9 namespace bang_bang {
10 
12  public:
15 
16  float default_temperature_low{NAN};
17  float default_temperature_high{NAN};
18 };
19 
20 class BangBangClimate : public climate::Climate, public Component {
21  public:
23  void setup() override;
24  void dump_config() override;
25 
26  void set_sensor(sensor::Sensor *sensor);
27  void set_humidity_sensor(sensor::Sensor *humidity_sensor);
28  Trigger<> *get_idle_trigger() const;
29  Trigger<> *get_cool_trigger() const;
30  void set_supports_cool(bool supports_cool);
31  Trigger<> *get_heat_trigger() const;
32  void set_supports_heat(bool supports_heat);
33  void set_normal_config(const BangBangClimateTargetTempConfig &normal_config);
34  void set_away_config(const BangBangClimateTargetTempConfig &away_config);
35 
36  protected:
38  void control(const climate::ClimateCall &call) override;
40  void change_away_(bool away);
42  climate::ClimateTraits traits() override;
43 
45  void compute_state_();
46 
48  void switch_to_action_(climate::ClimateAction action);
49 
51  sensor::Sensor *sensor_{nullptr};
53  sensor::Sensor *humidity_sensor_{nullptr};
54 
68  bool supports_cool_{false};
75  Trigger<> *heat_trigger_{nullptr};
76  bool supports_heat_{false};
81  Trigger<> *prev_trigger_{nullptr};
82 
84  bool supports_away_{false};
86 };
87 
88 } // namespace bang_bang
89 } // namespace esphome
void setup()
This class is used to encode all control actions on a climate device.
Definition: climate.h:33
This class contains all static data for climate devices.
Trigger * idle_trigger_
The trigger to call when the controller should switch to idle mode.
ClimateAction
Enum for the current action of the climate device. Values match those of ClimateMode.
Definition: climate_mode.h:31
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base-class for all sensors.
Definition: sensor.h:57
esphome::sensor::Sensor * sensor
Definition: statsd.h:38
ClimateDevice - This is the base class for all climate integrations.
Definition: climate.h:168
Trigger * cool_trigger_
The trigger to call when the controller should switch to cooling mode.