ScratMan / HASmartThermostat

Smart Thermostat with PID controller for HomeAssistant
370 stars 56 forks source link

hvac_action does not change to idle in some cases #239

Open thomas2403 opened 1 month ago

thomas2403 commented 1 month ago

I have set up a SmartThermostat for a room. Everything looks fine when it is heating. But when the current temperature is above the setpoint (desired temperature), the hvac_action stays at heating status and the control_output is at 5%. It never goes below 5% unless I do a restart. The example below show current_temperature: 23.5°C and temperature: 22°C with pid_i: 0. I would expect, that the output would go to 0%. But it stays at 5%. I want to switch off the gas boiler, when each thermostat is at idle state.

BTW, if someone is wondering. I use an mqtt device, which gives me room temperature and the setpoint for a room. It will only work in 0.5°C steps, but this is OK for me.

Actual status:

min_temp: 7 max_temp: 30 target_temp_step: 0.5 current_temperature: 23.5 temperature: 22 hvac_action: heating away_temp: null eco_temp: null boost_temp: null comfort_temp: null home_temp: null sleep_temp: null activity_temp: null control_output: 5 kp: 20 ki: 0.002 kd: 0 ke: 0 pid_mode: auto pid_i: 0 friendly_name: Thermostat DG Monika supported_features: 385

Config:

- platform: smart_thermostat name: Thermostat DG Monika unique_id: "smart_thermostat_dg_mo" heater: - number.e2m_dg_monika_nord_config_valve_position - number.e2m_dg_monika_sued_config_valve_position target_sensor: sensor.raumtemperatur_dg_mo min_temp: 7 max_temp: 30 ac_mode: False target_temp: 21 keep_alive: seconds: 60 kp: 20 ki: 0.002 kd: 0 ke: 0 output_min: 0 output_max: 100 pwm: 0 sampling_period: 60 target_temp_step: 0.5 hot_tolerance: 0.0 cold_tolerance: 0.0

Any idea, why this happens?

ScratMan commented 1 month ago

Please add debug: true to your configuration file and restart before checking the pid_p, pid_d and pid_e attributes. You may also look in the logs to see if an error occurs.

thomas2403 commented 1 month ago

Here is the situation again, this time with debug output. I still don't get it, why the output is not going to zero

min_temp: 7 max_temp: 30 target_temp_step: 0.5 current_temperature: 24.5 temperature: 22.5 hvac_action: heating away_temp: null eco_temp: null boost_temp: null comfort_temp: null home_temp: null sleep_temp: null activity_temp: null control_output: 5 kp: 20 ki: 0.002 kd: 0 ke: 0 pid_mode: auto pid_i: 0 pid_p: -40 pid_d: -0.0 pid_e: 0 pid_dt: 60.00013613700867 friendly_name: Thermostat DG Bad supported_features: 385

ScratMan commented 1 month ago

All pid_... are at 0, control_output being the sum, it shouldn't be non-null. Please look in the logs, there may be an exception raised by home assistant, preventing the PID output value to be stored and applied correctly in the thermostat.