ESPHome 2026.11.0b6
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 SUB_SENSOR(temperature)
21 SUB_SENSOR(humidity)
22
23 public:
25 void setup() override;
26 void dump_config() override;
27
28 void set_supports_cool(bool supports_cool) { this->supports_cool_ = supports_cool; }
29 void set_supports_heat(bool supports_heat) { this->supports_heat_ = supports_heat; }
30 void set_normal_config(const BangBangClimateTargetTempConfig &normal_config);
31 void set_away_config(const BangBangClimateTargetTempConfig &away_config);
32
33 Trigger<> *get_idle_trigger();
34 Trigger<> *get_cool_trigger();
35 Trigger<> *get_heat_trigger();
36
37 protected:
39 void control(const climate::ClimateCall &call) override;
41 void change_away_(bool away);
44
46 void compute_state_();
47
50
67
73 bool supports_cool_{false};
74 bool supports_heat_{false};
75
76 bool supports_away_{false};
77
80};
81
82} // namespace esphome::bang_bang
void compute_state_()
Re-compute the state of this climate controller.
BangBangClimateTargetTempConfig away_config_
bool supports_cool_
Whether the controller supports cooling/heating.
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 change_away_(bool away)
Change the away setting, will reset target temperatures to defaults.
Trigger * prev_trigger_
A reference to the trigger that was previously active.
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_
Trigger heat_trigger_
The trigger to call when the controller should switch to heating mode.
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
ClimateAction
Enum for the current action of the climate device. Values match those of ClimateMode.
uint16_t temperature
Definition sun_gtil2.cpp:12