ScratMan / HASmartThermostat

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

Negative control output #138

Closed Birkbjo closed 1 year ago

Birkbjo commented 1 year ago

Describe the bug

Have to preface and say I'm very new to this PID thing, and I may not fully understand it.

I am trying to control a PWM fan in a TV cabinet, and thus using ac_mode: True. I have NOT specified heater_inverted, I've also tried to set this to true, but to no effect.

Is it expected to have a negative value when using ac_mode: True?

Config:

  - platform: smart_thermostat
    kp: 5
    ki: 1
    kd: 500
    name: TV Cabinet Fan Thermostat
    unique_id: tv_cabinet_fan_thermostat
    heater: fan.tv_cabinet_fan_speed
    target_sensor: sensor.aqara_temp_tv_temperature
    min_temp: 17
    max_temp: 40
    ac_mode: True
    target_temp: 25
    keep_alive:
      seconds: 10
    pwm: 0
    debug: True

Attributes:

hvac_modes:
  - cool
  - 'off'
min_temp: 17
max_temp: 40
friendly_name: TV Cabinet Fan Thermostat
supported_features: 1
current_temperature: 24.4
temperature: 19
hvac_action: idle
away_temp: 14
control_output: -100
kp: 40 #( these are not updated )
ki: 0
kd: 0
ke: 0
pid_mode: auto
pid_i: 0
pid_p: -216
pid_d: -0.0
pid_e: 0
pid_dt: 0.0000026226043701171875

Also having trouble with the set PID values (kp, ki, kd) not updating after reload, but I'm not sure if those are just cached in the UI.

Expected behavior Expect control_output to be a positive value.

I could potentially create a template and use this to control the fan as a workaround? But I wonder if this is a bug or something I'm doing wrong.

Desktop (please complete the following information):

Birkbjo commented 1 year ago

Closing this since it's most probably not a bug? Will ask about my use case in discussions.