ScratMan / HASmartThermostat

Smart Thermostat with PID controller for HomeAssistant
345 stars 50 forks source link

min_cycle_duration parameter possible? #8

Closed nagyrobi closed 2 years ago

nagyrobi commented 2 years ago

Home Assistant's generic_thermostat integration has a great parameter named min_cycle_duration which is useful to prevent damage to the heating or cooling equipment due to too often switching it on and off.

I tried your component and this is how it behaves: kép

As you can see there are very short periods, of only a few seconds, for which the gas burner is turned off or on. This is problematic, because turning on the the gas burner is a process of at least 40-60 seconds (pump starts first for 20 seconds, pre-heats with small flame for another 20 seconds, and slowly increases flame to full afterwards). The PID algorithm makes too fast decisions, and turns on the gas for 30-40 seconds and it turns it off. Zero heat was sent to the house during during this. If this happens too fast the boiler will be damaged.

Normally one cycle of burning the gas for a central heating boiler should be at least 10 minutes, and after turning off another minimum 10 minutes should be waited before starting to burn again. This should be configurable with min_cycle_duration depending on the heating or cooling device type the user has. Can you please add this kind of override to the component?

nagyrobi commented 2 years ago

I tried to use

    keep_alive:
      seconds: 600

but still getting very short operation times.

ScratMan commented 2 years ago

Hi, you're right, this is an important parameter. It has been removed from the base code a while ago. I added it on a test version v2021.11.8-beta1 Could you please install and test this version and add this line to your smart_thermostat configuration and restart : min_cycle_duration: '00:10:00'

By setting the log level in configuration.yaml like follows you should see some messages in log telling what the thermostat is trying to do (request to turn on/off the boiler) and what the heating control does (accepts on/off commands or reject if cycle is too short).

logger:
  default: info
  logs:
    custom_components.smart_thermostat: debug

Rgds

nagyrobi commented 2 years ago

Testing, thank you!

ScratMan commented 2 years ago

Please check the impact on the temperature regulation, it may have higher/longer overshoot. Maybe it can be compensated by the PID gains.

nagyrobi commented 2 years ago

Looks good so far, I'll let it run for the night!

ScratMan commented 2 years ago

It may depend on the type of the heating system, radiators heating is fast and may overshoot a lot if the min cycle duration is longer than the computed PWM on time. Floor heating is much slower, so it should be almost seamless.

nagyrobi commented 2 years ago

I'll have to experiment, comparing with generic_thermostat which is a simple bang-bang controller.

ScratMan commented 2 years ago

I created a discussion with the beta version to discuss about that without overloading the issue. https://github.com/ScratMan/HASmartThermostat/discussions/11

ScratMan commented 2 years ago

Official release done

nagyrobi commented 2 years ago

Thank you.