7static const char *
const TAG =
"bang_bang.climate";
30 if (restore.has_value()) {
31 restore->to_call(
this).perform();
45 if (
call.get_mode().has_value())
47 if (
call.get_target_temperature_low().has_value())
49 if (
call.get_target_temperature_high().has_value())
51 if (
call.get_preset().has_value())
104 }
else if (too_hot) {
119 target_action = this->
action;
126 if (
action == this->action) {
160 if (trig !=
nullptr) {
163 ESP_LOGW(TAG,
"trig not set - unsupported action");
196 LOG_CLIMATE(
"",
"Bang Bang Climate",
this);
197 ESP_LOGCONFIG(TAG,
" Supports HEAT: %s", YESNO(this->
supports_heat_));
198 ESP_LOGCONFIG(TAG,
" Supports COOL: %s", YESNO(this->
supports_cool_));
199 ESP_LOGCONFIG(TAG,
" Supports AWAY mode: %s", YESNO(this->
supports_away_));
206 float default_temperature_high)
207 : default_temperature_low(default_temperature_low), default_temperature_high(default_temperature_high) {}
void stop_action()
Stop any action connected to this trigger.
void trigger(Ts... x)
Inform the parent automation that the event has triggered.
void compute_state_()
Re-compute the state of this climate controller.
void dump_config() override
BangBangClimateTargetTempConfig away_config_
void set_away_config(const BangBangClimateTargetTempConfig &away_config)
Trigger * get_cool_trigger() const
bool supports_cool_
Whether the controller supports cooling.
void set_supports_heat(bool supports_heat)
climate::ClimateTraits traits() override
Return the traits of this controller.
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.
Trigger * idle_trigger_
The trigger to call when the controller should switch to idle mode.
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.
Trigger * cool_trigger_
The trigger to call when the controller should switch to cooling mode.
void switch_to_action_(climate::ClimateAction action)
Switch the climate device to the given climate mode.
Trigger * heat_trigger_
The trigger to call when the controller should switch to heating mode.
Trigger * get_idle_trigger() const
BangBangClimateTargetTempConfig normal_config_
sensor::Sensor * humidity_sensor_
The sensor used for getting the current humidity.
void set_humidity_sensor(sensor::Sensor *humidity_sensor)
Trigger * get_heat_trigger() const
This class is used to encode all control actions on a climate device.
const optional< float > & get_target_temperature_low() const
const optional< ClimatePreset > & get_preset() const
const optional< float > & get_target_temperature_high() const
const optional< ClimateMode > & get_mode() const
ClimateMode mode
The active mode of the climate device.
float current_humidity
The current humidity of the climate device, as reported from the integration.
float target_temperature_low
The minimum 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.
ClimateAction action
The active state of the climate device.
void publish_state()
Publish the state of the climate device, to be called from integrations.
optional< ClimatePreset > preset
The active preset of the climate device.
optional< ClimateDeviceRestoreState > restore_state_()
Restore the state of the climate device, call this from your setup() method.
float target_temperature_high
The maximum target temperature of the climate device, for climate devices with split target temperatu...
This class contains all static data for climate devices.
void set_supported_modes(std::set< ClimateMode > modes)
void set_supports_action(bool supports_action)
void set_supports_current_humidity(bool supports_current_humidity)
void set_supports_two_point_target_temperature(bool supports_two_point_target_temperature)
void set_supported_presets(std::set< ClimatePreset > presets)
void add_supported_mode(ClimateMode mode)
void set_supports_current_temperature(bool supports_current_temperature)
Base-class for all sensors.
void add_on_state_callback(std::function< void(float)> &&callback)
Add a callback that will be called every time a filtered value arrives.
float state
This member variable stores the last state that has passed through all filters.
@ CLIMATE_PRESET_AWAY
Device is in away preset.
@ CLIMATE_PRESET_HOME
Device is in home preset.
@ CLIMATE_MODE_HEAT
The climate device is set to heat to reach the target temperature.
@ CLIMATE_MODE_COOL
The climate device is set to cool to reach the target temperature.
@ CLIMATE_MODE_HEAT_COOL
The climate device is set to heat/cool to reach the target temperature.
@ CLIMATE_MODE_OFF
The climate device is off.
ClimateAction
Enum for the current action of the climate device. Values match those of ClimateMode.
@ CLIMATE_ACTION_OFF
The climate device is off (inactive or no power)
@ CLIMATE_ACTION_IDLE
The climate device is idle (monitoring climate but no action needed)
@ CLIMATE_ACTION_HEATING
The climate device is actively heating.
@ CLIMATE_ACTION_COOLING
The climate device is actively cooling.
Providing packet encoding functions for exchanging data with a remote host.
BangBangClimateTargetTempConfig()
float default_temperature_high
float default_temperature_low