ScratMan / HASmartThermostat

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

Switches off on temp change #24

Closed csmit86 closed 2 years ago

csmit86 commented 2 years ago

Whenever the temp changes by 0,1 the heater switches off -> on -> off, and remains off even if its below the target temp. Also doesn't automatically turn on when below target temp.

ScratMan commented 2 years ago

Hi, this issue may be due to the sampling rate of your sensor which is too high. For example some sensors are reporting temperature every 30 seconds, and then the temperature may oscillate by +/- 0.1°C around the averaged temperature. This leads to issues with PID as the derivative part is computed by dividing the input delta by the time delta : if the time delta is short, the D part will be high, and as output = P+I-D, if D increases the output is decreased.

To avoid this issue, you should set the sampling_period parameter in the configuration file to several minutes (5, 10 or 15 minutes, depending if your heating system is fast or slow).

csmit86 commented 2 years ago

Hm not sure. So I installed with HACS and setup the config. I set the thermostat on Confort mode (20) and my current themp is 17,8: thermostat remains idle.. When I switch on the heater myself the thermostat switched back to idle after the temp changes and turns the heater off.. So basically it is doing the opposite of what it supposed to do. Could there be an issue with my temp sensor displaying with , instead of . ?

Config.yaml

climate:
  - platform: smart_thermostat
    name: Smart Thermostat
    unique_id: my_smart_thermostat
    heater: switch.verwarming
    target_sensor: sensor.thermometer
    target_temp_step: 1
    sampling_period: 1200
    min_temp: 15
    max_temp: 25
    ac_mode: False
    keep_alive:
      seconds: 60
    comfort_temp: 20
    home_temp: 19.5
    eco_temp: 19
    away_temp: 16
    kp : 5
    ki : 0.01
    kd : 500
    pwm : 00:15:00
ScratMan commented 2 years ago

Could you please make a trial by setting pwm: 900 instead of 00:15:00 ?

csmit86 commented 2 years ago

I fiddled with the PID values and its seems to work now. Thx