7 static const char *
const TAG =
"bang_bang.climate";
30 if (restore.has_value()) {
31 restore->to_call(
this).perform();
104 }
else if (too_hot) {
119 target_action = this->
action;
126 if (action == this->action) {
160 assert(trig !=
nullptr);
193 LOG_CLIMATE(
"",
"Bang Bang Climate",
this);
194 ESP_LOGCONFIG(TAG,
" Supports HEAT: %s", YESNO(this->
supports_heat_));
195 ESP_LOGCONFIG(TAG,
" Supports COOL: %s", YESNO(this->
supports_cool_));
196 ESP_LOGCONFIG(TAG,
" Supports AWAY mode: %s", YESNO(this->
supports_away_));
203 float default_temperature_high)
204 : default_temperature_low(default_temperature_low), default_temperature_high(default_temperature_high) {}
This class is used to encode all control actions on a climate device.
sensor::Sensor * sensor_
The sensor used for getting the current temperature.
The climate device is off (inactive or no power)
float current_humidity
The current humidity of the climate device, as reported from the integration.
void add_on_state_callback(std::function< void(float)> &&callback)
Add a callback that will be called every time a filtered value arrives.
Trigger * prev_trigger_
A reference to the trigger that was previously active.
Trigger * heat_trigger_
The trigger to call when the controller should switch to heating mode.
Device is in home preset.
void set_normal_config(const BangBangClimateTargetTempConfig &normal_config)
const optional< ClimateMode > & get_mode() const
void set_supports_current_humidity(bool supports_current_humidity)
This class contains all static data for climate devices.
The climate device is set to heat to reach the target temperature.
ClimateMode mode
The active mode of the climate device.
const optional< float > & get_target_temperature_low() const
bool supports_cool_
Whether the controller supports cooling.
float target_temperature_high
The maximum target temperature of the climate device, for climate devices with split target temperatu...
float current_temperature
The current temperature of the climate device, as reported from the integration.
float default_temperature_high
float default_temperature_low
void set_supports_heat(bool supports_heat)
void set_supported_presets(std::set< ClimatePreset > presets)
Trigger * get_cool_trigger() const
void trigger(Ts... x)
Inform the parent automation that the event has triggered.
Device is in away preset.
Trigger * idle_trigger_
The trigger to call when the controller should switch to idle mode.
BangBangClimateTargetTempConfig away_config_
The climate device is set to cool to reach the target temperature.
float state
This member variable stores the last state that has passed through all filters.
void control(const climate::ClimateCall &call) override
Override control to change settings of the climate device.
const optional< ClimatePreset > & get_preset() const
Trigger * get_idle_trigger() const
optional< ClimatePreset > preset
The active preset of the climate device.
Trigger * get_heat_trigger() const
void dump_config() override
void set_supported_modes(std::set< ClimateMode > modes)
ClimateAction
Enum for the current action of the climate device. Values match those of ClimateMode.
void compute_state_()
Re-compute the state of this climate controller.
The climate device is set to heat/cool to reach the target temperature.
The climate device is actively heating.
void publish_state()
Publish the state of the climate device, to be called from integrations.
void set_away_config(const BangBangClimateTargetTempConfig &away_config)
The climate device is off.
void set_supports_action(bool supports_action)
void change_away_(bool away)
Change the away setting, will reset target temperatures to defaults.
void set_supports_cool(bool supports_cool)
climate::ClimateTraits traits() override
Return the traits of this controller.
BangBangClimateTargetTempConfig()
void switch_to_action_(climate::ClimateAction action)
Switch the climate device to the given climate mode.
void set_sensor(sensor::Sensor *sensor)
Implementation of SPI Controller mode.
The climate device is idle (monitoring climate but no action needed)
void set_humidity_sensor(sensor::Sensor *humidity_sensor)
void set_supports_two_point_target_temperature(bool supports_two_point_target_temperature)
optional< ClimateDeviceRestoreState > restore_state_()
Restore the state of the climate device, call this from your setup() method.
void set_supports_current_temperature(bool supports_current_temperature)
const optional< float > & get_target_temperature_high() const
Base-class for all sensors.
sensor::Sensor * humidity_sensor_
The sensor used for getting the current humidity.
BangBangClimateTargetTempConfig normal_config_
The climate device is actively cooling.
void add_supported_mode(ClimateMode mode)
esphome::sensor::Sensor * sensor
float target_temperature_low
The minimum target temperature of the climate device, for climate devices with split target temperatu...
void stop_action()
Stop any action connected to this trigger.
ClimateAction action
The active state of the climate device.
Trigger * cool_trigger_
The trigger to call when the controller should switch to cooling mode.