Closed bigbread59 closed 2 years ago
I checked the code, and the PID calculate function is called when the set point is changed, except if the thermostat is in off mode or if either the set point or the current temperature is None. I don't understand how this issue can occur. 🤔
There is probably no problem.
I was misled by the fact that there is a delay between log file:
2021-12-02 11:31:52 DEBUG (MainThread) [custom_components.smart_thermostat.climate] Obtained current control output. 100.00 (error = 1.81, dt = 60.00, p=162.90, i=20.13, d=-0.00)
and the data shown in the status:
hvac_modes:
- heat
- 'off'
min_temp: 15
max_temp: 21
preset_modes:
- none
- away
current_temperature: 17.4
temperature: 17
hvac_action: idle
preset_mode: none
away_temp: 14
eco_temp: null
boost_temp: null
comfort_temp: null
home_temp: null
sleep_temp: null
activity_temp: null
**control_output: 0**
Kp: 90
Ki: 0.005
Kd: 10000
pid_p: -38.699999999999974
pid_i: 20.133738843336406
pid_d: -0.0
autotune_status: 'off'
autotune_sample_time: 0
autotune_tuning_rule: none
autotune_set_point: 0
autotune_peak_count: 0
autotune_buffer_full: 0
autotune_buffer_length: 0
friendly_name: PID_Thermostat_HA
supported_features: 17
Oh, yes, the status update in HA is asynchronous, so there may be some updates not fully propagated in the UI.
I noticed that in case of modification of the "temperature" parameter (target temperature), the parameters: pid_p: pid_i: pid_d: are not updated "instantly" but the update is performed only at the first variation of the "current_temperature".
This leads to a delay in the action of the thermostat and an overshoot of the temperature in case of a decrease in target_temperature.