ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
bang_bang_climate.h
Go to the documentation of this file.
1#pragma once
2
7
8namespace esphome::bang_bang {
9
18
19class BangBangClimate final : public climate::Climate, public Component {
20 public:
22 void setup() override;
23 void dump_config() override;
24
25 void set_sensor(sensor::Sensor *sensor) { this->sensor_ = sensor; }
26 void set_humidity_sensor(sensor::Sensor *humidity_sensor) { this->humidity_sensor_ = humidity_sensor; }
27 void set_supports_cool(bool supports_cool) { this->supports_cool_ = supports_cool; }
28 void set_supports_heat(bool supports_heat) { this->supports_heat_ = supports_heat; }
29 void set_normal_config(const BangBangClimateTargetTempConfig &normal_config);
30 void set_away_config(const BangBangClimateTargetTempConfig &away_config);
31
35
36 protected:
38 void control(const climate::ClimateCall &call) override;
40 void change_away_(bool away);
43
45 void compute_state_();
46
49
54
71
77 bool supports_cool_{false};
78 bool supports_heat_{false};
79
80 bool supports_away_{false};
81
84};
85
86} // namespace esphome::bang_bang
void compute_state_()
Re-compute the state of this climate controller.
BangBangClimateTargetTempConfig away_config_
void set_away_config(const BangBangClimateTargetTempConfig &away_config)
bool supports_cool_
Whether the controller supports cooling/heating.
void set_supports_heat(bool supports_heat)
climate::ClimateTraits traits() override
Return the traits of this controller.
Trigger idle_trigger_
The trigger to call when the controller should switch to idle mode.
void control(const climate::ClimateCall &call) override
Override control to change settings of the climate device.
void set_sensor(sensor::Sensor *sensor)
void set_supports_cool(bool supports_cool)
void change_away_(bool away)
Change the away setting, will reset target temperatures to defaults.
void set_normal_config(const BangBangClimateTargetTempConfig &normal_config)
Trigger * prev_trigger_
A reference to the trigger that was previously active.
sensor::Sensor * sensor_
The sensor used for getting the current temperature.
void switch_to_action_(climate::ClimateAction action)
Switch the climate device to the given climate mode.
Trigger cool_trigger_
The trigger to call when the controller should switch to cooling mode.
BangBangClimateTargetTempConfig normal_config_
sensor::Sensor * humidity_sensor_
The sensor used for getting the current humidity.
Trigger heat_trigger_
The trigger to call when the controller should switch to heating mode.
void set_humidity_sensor(sensor::Sensor *humidity_sensor)
This class is used to encode all control actions on a climate device.
Definition climate.h:31
ClimateDevice - This is the base class for all climate integrations.
Definition climate.h:192
ClimateAction action
The active state of the climate device.
Definition climate.h:320
Base-class for all sensors.
Definition sensor.h:47
ClimateAction
Enum for the current action of the climate device. Values match those of ClimateMode.