jmcollin78 / versatile_thermostat

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

resume from previous state #325

Closed cyrildumas closed 9 months ago

cyrildumas commented 10 months ago

Hello,

Is your feature request related to a problem? Please describe. I have observed that after a restart of home assistant the regulation of the room start again from the beginning which is the target temp indicated in the VT. The slave thermostat is configured back again with the target temp and the regulation can take few hours before finding again the correct temperature the slve thermostat has to have in order to have the target temp in the room. Since we have to reboot HA very frequently because of the different updates this is very annoying

Describe the solution you'd like Maybe you can save the state of the VT on a local file after each order sent to the slave thermostat so that it can be resumed after a restart of HA

Describe alternatives you've considered none

Additional context My setup: I have reversible air conditioning at home therefor I am using thermostat over climate. 4 splits are configured with medium self regulation and with expert mode like below

versatile_thermostat: auto_regulation_expert: kp: 0.4 ki: 0.08 k_ext: 0.0 offset_max: 10 stabilization_threshold: 0.1 accumulated_error_threshold: 50

Regulation Threshold 1 Regulation minimal period 30

image

I hope this time I did it correctly. Regards Cyril

jmcollin78 commented 10 months ago

Hello @cyrildumas ,

I have observed that after a restart of home assistant the regulation of the room start again from the beginning which is the target temp indicated in the VT.

This should not. The accumulated_error which is the parameter that controls the regulation is persistent. You can check this by looking its value in the VTherm attributes after a reboot. It should be restored to its value after a reboot.

I cannot understand why you have such behaviour. Can you please add the EMA in the graph ?. When you restart the EMA is recalculated and maybe this is point.

I hope this time I did it correctly.

Yes perfect ! You see how much easier it is for me to understand the context and what happens.

cyrildumas commented 10 months ago

Hello Jean-Marc,

In my example, Chambre_Victoria, the regulation parameters are: kp: 0.4 ki: 0.08 k_ext: 0.0 offset_max: 10 stabilization_threshold: 0.1 accumulated_error_threshold: 50

Before reboot, the accumulated error parameter for this climate equal 47.3 and after reboot 2.9 so it seems that the previous value was not restored. I am attaching the logs just in case but I did not see anything useful. home-assistant_2024-01-09T10-13-46.427Z.log

In regards to your second question, the graph is already using the EMA. This behavior is because I am using a broadlink universal remote including a temperature sensor. One of the only location I have in this room is in the direction of the air flux of the air conditioner hence the spike. I moved it.

image

Regards Cyril

jmcollin78 commented 10 months ago

The EMA is a entity that it is not displayed in your graph. If you look at the README, you have missed this part I guess (in the Plotly definition) :

    - entity: '[[climate]]'
      attribute: ema_temp
      yaxis: y1
      name: Ema

Before reboot, the accumulated error parameter for this climate equal 47.3 and after reboot 2.9 so it seems that the previous value was not restored. I am attaching the logs just in case but I did not see anything useful.

I will check that. I'm pretty sure it was working.

cyrildumas commented 10 months ago

For the graph, yes I saw it in the readme file, I just kept only the EMA and renamed it for my own convenience. See below image

For the bug, if bug there is, I will help in anyway I can. Regards Cyril

turbolooser commented 10 months ago

Not sure but seems I am having the same issue. When i turn off my climate and then turn it on again it all starts from scratch. On reboot the same also. Hopefully you find something

jmcollin78 commented 10 months ago

Before restart:

current_temperature: 18.8
temperature: 17
is_regulated: true
ema_temp: 18.96
regulated_target_temperature: 14.5
auto_regulation_mode: auto_regulation_strong
regulation_accumulated_error: -20.800000000000004

Just after restart of HA:

is_regulated: true
regulated_target_temperature: 17
auto_regulation_mode: auto_regulation_strong
regulation_accumulated_error: 0

So I can confirm there is a bug. The regulation_accumulated_error have been restored.

jmcollin78 commented 10 months ago

Found and fixed !

cyrildumas commented 10 months ago

Fantastic. Thank you very much Jean-Marc.

jmcollin78 commented 10 months ago

You can have the fix in beta release here: https://github.com/jmcollin78/versatile_thermostat/releases/tag/5.4.0-beta2

If you can give it a try, please let me know.

cyrildumas commented 9 months ago

I have tested it for few days and so far so good.

jmcollin78 commented 9 months ago

Thank you for the feedback. I will try to release this week-end (I have another big change running)

jmcollin78 commented 9 months ago

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