ESPHome  2021.11.3
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  Trigger<> *get_idle_trigger() const;
28  Trigger<> *get_cool_trigger() const;
29  void set_supports_cool(bool supports_cool);
30  Trigger<> *get_heat_trigger() const;
31  void set_supports_heat(bool supports_heat);
32  void set_normal_config(const BangBangClimateTargetTempConfig &normal_config);
33  void set_away_config(const BangBangClimateTargetTempConfig &away_config);
34 
35  protected:
37  void control(const climate::ClimateCall &call) override;
39  void change_away_(bool away);
41  climate::ClimateTraits traits() override;
42 
44  void compute_state_();
45 
47  void switch_to_action_(climate::ClimateAction action);
48 
50  sensor::Sensor *sensor_{nullptr};
64  bool supports_cool_{false};
71  Trigger<> *heat_trigger_{nullptr};
72  bool supports_heat_{false};
77  Trigger<> *prev_trigger_{nullptr};
78 
80  bool supports_away_{false};
82 };
83 
84 } // namespace bang_bang
85 } // 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
Library based on https://github.com/miguelbalboa/rfid and adapted to ESPHome by . ...
Definition: a4988.cpp:4
Base-class for all sensors.
Definition: sensor.h:47
ClimateDevice - This is the base class for all climate integrations.
Definition: climate.h:167
Trigger * cool_trigger_
The trigger to call when the controller should switch to cooling mode.