Skip to content

Autotune leading to ZeroDivisionError exception #23

Description

@ScratMan

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions