7 static const char *
const TAG =
"pid.climate";
29 if (restore.has_value()) {
30 restore->to_call(
this).perform();
75 LOG_CLIMATE(
"",
"PID Climate",
this);
76 ESP_LOGCONFIG(TAG,
" Control Parameters:");
81 ESP_LOGCONFIG(TAG,
" Deadband disabled.");
83 ESP_LOGCONFIG(TAG,
" Deadband Parameters:");
84 ESP_LOGCONFIG(TAG,
" threshold: %0.5f to %0.5f, multipliers(kp: %.5f, ki: %.5f, kd: %.5f), output samples: %d",
120 if (new_action != this->
action) {
121 this->
action = new_action;
139 if (res.result_params.has_value()) {
163 this->
autotuner_->config(min_value, max_value);
167 "%s: Autotune has started. This can take a long time depending on the " 168 "responsiveness of your system. Your system " 169 "output will be altered to deliberately oscillate above and below the setpoint multiple times. " 170 "Until your sensor provides a reading, the autotuner may display \'nan\'",
173 this->
set_interval(
"autotune-progress", 10000, [
this]() {
179 ESP_LOGW(TAG,
"%s: !!! For PID autotuner you need to set AUTO (also called heat/cool) mode!",
This class is used to encode all control actions on a climate device.
The climate device is off (inactive or no power)
float current_humidity
The current humidity of the climate device, as reported from the integration.
output::FloatOutput * cool_output_
bool supports_cool_() const
void add_on_state_callback(std::function< void(float)> &&callback)
Add a callback that will be called every time a filtered value arrives.
void set_interval(const std::string &name, uint32_t interval, std::function< void()> &&f)
Set an interval function with a unique name.
void reset_integral_term()
void write_output_(float value)
float target_temperature
The target temperature of the climate device.
sensor::Sensor * humidity_sensor_
The sensor used for getting the current humidity.
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.
float current_temperature
The current temperature of the climate device, as reported from the integration.
void start_autotune(std::unique_ptr< PIDAutotuner > &&autotune)
std::string get_object_id() const
std::unique_ptr< PIDAutotuner > autotuner_
void set_level(float state)
Set the level of this float output, this is called from the front-end.
void reset_accumulated_integral()
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 set_supported_modes(std::set< ClimateMode > modes)
ClimateAction
Enum for the current action of the climate device. Values match those of ClimateMode.
float update(float setpoint, float process_value)
The climate device is set to heat/cool to reach the target temperature.
void control(const climate::ClimateCall &call) override
Override control to change settings of the climate device.
The climate device is actively heating.
const optional< float > & get_target_temperature() const
void publish_state()
Publish the state of the climate device, to be called from integrations.
The climate device is off.
climate::ClimateTraits traits() override
Return the traits of this controller.
void set_supports_action(bool supports_action)
sensor::Sensor * sensor_
The sensor used for getting the current temperature.
bool supports_heat_() const
void dump_config() override
output::FloatOutput * heat_output_
Implementation of SPI Controller mode.
PIDController controller_
The climate device is idle (monitoring climate but no action needed)
void set_supports_two_point_target_temperature(bool supports_two_point_target_temperature)
float default_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)
float output_value_
Output value as reported by the PID controller, for PIDClimateSensor.
The climate device is actively cooling.
void add_supported_mode(ClimateMode mode)
CallbackManager< void()> pid_computed_callback_
ClimateAction action
The active state of the climate device.