jmcollin78 / versatile_thermostat

A full featured Thermostat for Home Assistant: presets, window, motion, presence and overpowering management
MIT License
326 stars 34 forks source link

[Feature Request] - Add an auto-start/stop feature for over_climate VTherm #585

Closed jmcollin78 closed 2 weeks ago

jmcollin78 commented 3 weeks ago

As a over_climate VTherm user, I often need to turn off manually the VTherm (and so the device) when no device is needed due to correct temperature conditions, So that, It will turn off the fan and save more energy.

To do that:

  1. A new feature is added in the list of features,
  2. An auto_start/stop detection level is added into the same page. 4 detection levels will be available:
    • none: no auto-start/stop is allowed
    • slow: auto-start/stop will be used if there is really no need of device soon,
    • fast: auto-start/stop will be used as soon as the device is no more useful,
    • medium: the intermediate configuration.
  3. Add an entity in the VTherm device of type select which enable to change the detection level. The user will be able to enable or disable the auto-start/stop feature from an automation or simply change the level of needed.

With this only two parameters and an entity it should be possible to:

  1. avoid too much unwanted start/stop. We should avoid starting and stop after each regulation cycle,
  2. avoid starting a device when you are not present for a long time. You don't want your AC device to turn on when you are on holidays I guess.

Warning: this feature can interact with the window detection which turn off the VTherm (depending on the configuration). The first detection condition (window detection or auto-start/stop) will take the lead and block the second eventual condition.

Detection algorithm: We use the current_temperature, target_temperature and slope temperature calculation to evaluate the need to start or stop.

We calculate an accumulated_error over time like that: accumulated_error = accumulated_error + (target - current) * weight

where weight is the total seconds with the last measure divided by 2 min (so that if 2 two measure are spaced by 2 minutes the weight is one).

  1. if enable aut-start/stop is off, stop here.
  2. If VTherm is on and in heating mode, when error_accumulated is < -error_threshold -> turn off and save hvac mode,
  3. If VTherm is on and in Cooling mode, when error_accumulated is > error_threshold -> turn off and save hvac mode,
  4. If VTherm is off and saved hvac mode is Heating and current_temperature + slope x dt <= target_temperature then turn on and set havc mode to the saved hvac_mode,
  5. If VTherm is off and saved hvac mode is Cooling and current_temperature + slope x dt >= target_temperature then turn on and set havc mode to the saved hvac_mode

error_threshold is set to respectively 10 (° * min) in slow, 5 in medium and 2 in fast. dt is set to respectively 30 min in slow, 15 min in medium and 7 min in fast detection level.

current_temperature + slope x dt <= target_temperature means that in dt minute, we will probably need to heat (resp. cool)

Event: When auto-start/stop is doing something, a new event is sent to inform what have been done. This can be catch for automation.

Preset change: On a preset change, the algorithm describe above should be run to turn on or off the device.

jmcollin78 commented 3 weeks ago

Feel free to add comment or suggestion to this feature request. And vote for it with a 👍 if you are interested.

jmcollin78 commented 2 weeks ago

A beta release to test in real conditions: https://github.com/jmcollin78/versatile_thermostat/releases/tag/6.5.0.beta1

It is working fine on my environment.

cyrildumas commented 2 weeks ago

Hello Jean Marc, I just installed beta 6 for test. I will keep you posted Regards Cyril

jmcollin78 commented 2 weeks ago

https://github.com/jmcollin78/versatile_thermostat/releases/tag/6.5.0

sltelitsyn commented 2 weeks ago

Thank you very much! As soon as I’d have an opportunity, I’d test it.

jmcollin78 commented 2 weeks ago

Let me known. I have it running for 3 days now and it is working fine.

cyrildumas commented 2 weeks ago

Same here, I had to adjust between fast slow and medium depending on the rooms but so far so good.

antcodd commented 1 week ago

Is there also a way to automatically toggle between heating and cooling mode? At some times of the year where I live there is need for cooling during the hottest part of the day and heating late at night. Usually it is sensible to be off in the middle, but it would be good to flip hvac_mode if too far out of the target temperature range in the opposite direction that would have caused turning on had it been in that saved mode. I don't like the AC built in heat_cool mode as it tends to give up too early and end up at least a degree off target (plus leaving the AC on unnecessarily, which makes some moderate temperates too cold due to airflow)

With Sensibo I have a convoluted set of app climate react schedules that I'd like to come close to replicating with VTherm with more intelligent auto off behaviour. With the Sensibo app I keep having to add more and more scheduled off or temperature threshold off 1 hour times to avoid unhelpful cases in the boundaries between time periods (like unnecessarily getting stuck cooling when the outside temperature is rapidly dropping anyway).

Night time: target temperate 18, turn on heating if below 17, turn on cooling if above 22

Evening: target temperature 22, turn on heating below 21, turn on cooling above 24. Heat loss through window frames makes 20 feel cold.

Day: Turn on heating below 18, cooling above 24. Heat gain from sun makes 20 acceptable if AC is not attempting cooling.

This effectively tries to maintain a target temperature of 18-24 during the day, 21-24 during the evening and 17-22 at night.

I could probably do the mode flipping with an automation but it would be nice to be built in to the auto-off feature.

jmcollin78 commented 1 week ago

Hello @antcodd,

This could be an idea but will be used 2 times per years and only if your device is HEAT and COOL. So it is too rare to be a core feature for my opinion. If you write an automation, you can post it into the discussions, maybe someone will be interested.