aendle / custom_components

missing feature test reposetory
66 stars 33 forks source link

Autotune leading to ZeroDivisionError exception #23

Open ScratMan opened 2 years ago

ScratMan commented 2 years ago

Hello, I configured the smart_thermostat on my Home Assistant core (docker contained) instance.

I set the climate entity with the following configuration :

- platform: smart_thermostat name: salle_de_bain heater: switch.seche_serviette target_sensor: sensor.popp_mold_salle_de_bain_temperature min_temp: 7 max_temp: 30 ac_mode: False target_temp: 24 keep_alive: seconds: 5 # initial_operation_mode: "off" kp : 5 ki : 3 kd : 2 pwm : 1 autotune : ziegler-nichols difference : 100 noiseband : 0.5

I set the target temperature so that the thermostat could activate the heater at reboot, as the temperature in the room was 23°C at that moment. Otherwise the autotune left the thermostat completely off.

The smart thermostat kept the heater ON for 2h30' and then stopped it when temperature sensor indicated 24.7°C. The temperature then continued to raise up to 25.9 during 1h30'. The temperature then slowly decreased for 4h down to 24.8°C and then the autotune tried to compute the parameters and failed with the following error:

2021-10-01 20:37:32 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/smart_thermostat/climate.py", line 433, in _async_control_heating await self.calc_output() File "/config/custom_components/smart_thermostat/climate.py", line 476, in calc_output params = self.pidAutotune.get_pid_parameters(self.autotune) File "/config/custom_components/smart_thermostat/pid_controller/init.py", line 188, in get_pid_parameters ki = kp / (self._Pu / divisors[1]) ZeroDivisionError: float division by zero

It seems the self._Pu remained at 0 during the full process, but no information why.