ScratMan / HASmartThermostat

Smart Thermostat with PID controller for HomeAssistant
336 stars 48 forks source link

Missed 'min cycles' after call reload service #128

Closed GoNzCiD closed 1 year ago

GoNzCiD commented 1 year ago

Describe the bug After call to the reload service, the min periods (at least min_cycle_duration and min_off_cycle_duration) are not taken in account anymore.

To Reproduce Steps to reproduce the behavior:

  1. Define min_cycle_duration in the yaml config file.
  2. Call the reload service
  3. Note that the periods the thermostat is open are shorter than the defined in the min_cycle_duration

Expected behavior Respect the time of the "min..." periods.

Screenshots imagen Same configuration, but during the morning min times are not applied (I performed a reload last night), during the evening after a HA restart.

  min_cycle_duration: 00:50:00
  min_off_cycle_duration: 00:05:00
ScratMan commented 1 year ago

Hello, please test with master branch. To install master branch, go to HACS, click on "Integrations", select the Smart Thermostat (PID), click on the three dots menu in the top right corner and select "Redownload". Wait for the "Version select" drop down list to be available, and select master in the bottom of the list, next click on "Download". Once the integration is installed, reboot HA.

GoNzCiD commented 1 year ago

OK, I'll try it, I just upgraded it following the HACS notification, and I'm running 2023.1.1

GoNzCiD commented 1 year ago

6 Hours ago (more or less) I download the master version, restart HA, and call the reload service. So, @ScratMan, you are right, in this versions seems to works!

Do you plan to release a version with a mayor number to avoid the HACS repository alert you with a new update?

Thanks!

ScratMan commented 1 year ago

Yes, i'll push a release.

GoNzCiD commented 1 year ago

Hi again @ScratMan, I guess something similar is happening with the constants kp, ki, kd & ke... They are not updated if the yaml is modified...

ScratMan commented 1 year ago

That's normal. The PID gains and preset temperatures are always restored from previous state stored in HA database. Once HA is running, gains and preset should be modified using the corresponding services, they are applied without need of reboot. The values in the YAML is only used for first start or if the database is deleted or corrupted.

I recommend to update the YAML once you've found the best settings that fit your needs.

GoNzCiD commented 1 year ago

ACK, I added it by the service once I noticed they weren't updated from the yaml. Thanks for clarify it.

teklabania commented 5 months ago

@ScratMan, I'm using version 2023.10.0 and also noticed that min_cycle_duration is not honored. I've set it to 00:15:00 but I can see that heaters are switched for example for 3 minutes.

- platform: smart_thermostat
  name: Thermostat X
  heater: light.heater_x
  target_sensor: sensor.temperature_x
  kp: 100
  ki: 0.0005
  kd: 100000
  ke: 0.6
  outdoor_sensor: sensor.tomorrow_io_dom_temperature
  min_temp: 15
  max_temp: 25
  away_temp: 20
  boost_pid_off: true
  precision: 0.1
  keep_alive: 00:01:00
  pwm: 02:00:00
  min_cycle_duration: 00:15:00
  target_temp: 21
  boost_temp: 21.5