hacker-cb/hassio-component-smart-thermostat

How to stop heating BEFORE the target is reached?

Opened this issue · 10 comments

Hello dear dev.

First, thank you very much for this work. I'm glad, I can make use of it.

What i now need to ask is not exactly an issue, but a question.

The situation:

I have built a climate box for my wife to be used for fermentation processes for lovely food.

It has a cooling element and a heater element. They both are driven by a WiFi switch and controlled by your thermostat.

The issue I have is, that the heater element has quiet slow energy transition. When I reach the set-point, it switches off, as it should, no problem there. But the element is still hot and will still release some energy. So the temperature inside the box still rises for a while.
That is enough for the thermostat to start cooling. And that cycle repeats it self.
This is a waste of energy. I need the heater to stop earlier, before it reaches the set-point just a little, so it will reach the set-point in the period after it is switched off an cooling will not be needed.

I don't want to solve this just by setting the thermostat to heat only. The box needs to stay both ways ready, so wife can get the warmed stuff out, put new in and set a low temperature without the need to switch mode.

Example:

Set temperature is 30
We start with current temp 20.
Heater switch goes on.
Heater switch stops when current temperature is 29 as we know, that the temperature will keep rising 1 degree after the switch is off.

Any idea, how to implement this easy?

I hope, you can help me to find the right way.

Thank you very much in advance.

Hello.

You can try to use PID controller and PWM mode with your switch.
It is not easy to tune and find correct PID multipliers.
Check README for the details of the switch PWM mode.

Wow, what a superfast response! Chapeau! ;-)

Can you please show me, how would i implement this in my code?
I do understand almost, how its logic work, so the adjust I will manage somehow.
Just please give me correct example, how it will be written in my code.

# Thermostaten
climate:
  - platform: smart_thermostat
    name: Rotkast
    target_sensor: sensor.aeotec_humitemp_rotkast_air_temperature
    min_temp: 8
    max_temp: 42
    precision: 0.1
    heater: switch.sonoff_1001041627
    cooler: switch.sonoff_100103c57c
    sensor_stale_duration:
      minutes: 10
    heat_cool_cold_tolerance: 0.1
    heat_cool_hot_tolerance: 0.1

Thank you very much

You need to adjust PID params according your system.
There are no standard P,I,D multipliers, it is very individual.

Please check General recommendations for PID tuning.

Below is my working config for room with water-driven heating floor:

    - platform: smart_thermostat
      name: thermostat_bedroom
      heater:
        - entity_id: switch.wb1_wb_mr6c_22_k4
          pid_params: 0.1, 0.001, 0
          pid_sample_period: "00:01:00"
          pwm_period: "00:05:00"
      cooler: input_boolean.thermostat_bedroom_demand_cool
      target_sensor: sensor.multisensor_bedroom_temperature
      min_temp: 15
      max_temp: 28
      precision: 0.1

Thank you, i will try.

And again, your fast response is honorable ;-)

You are welcome :)

Can you explain a bit more about how the PWM parameters are used? I am running an HVAC system using your controller, and am not using the PID configuration (yet). The HVAC system has long start and stop cycles that account for the overshoot in my system. I'd like to use the PID to tune this out, but I'm concerned the PWM is thinking of the heater like a quick on/off switch or like a motor speed control, which won't work for this application.

@brettonw please check Behavior section of the PWM Switch PID controller in README.

@hacker-cb the behavior section for PWM in the PID mode reads like it’s notes and is not sufficiently expository. Can you say MORE about your expectation for the PWM application, maybe how it fits the type of scenario I described?

@brettonw it is not quick PWM, (several times or several hundred/thousands times a second).

You should set pwm_period depending on our system.
For example, for my water-driven heating floor valve I set it to 5 minutes.

PWM value will be set by internal PID regulator, according input and pid_params. It limits 0-100%.

So, if PWM value is 40%, than in every 5 minutes switch will be 2 mins - on, 3 mins off.

I don't know how to explain more clearly, sorry.

That was good, thank you.