Closed rjosborne closed 2 weeks ago
Hello, yes this is common kwown limitation of VTherm. At restart, all dynamic states (the open window state in your case) is not restored and I'm not sure it is a good idea to implement this:
So my opinion is to NOT store and restore the dynamic states like window open state.
I wanted to open the same issue but found this one. So started to elaborate different way :)
@rjosborne The way to go is and automation done at HA startup. I tried several combination and sequences but this one works and does what we want - to restore the state to off and after windows close to heat.
alias: Thermostats preparation on startup
description: ""
triggers:
- trigger: homeassistant
event: start
conditions: []
actions:
- delay:
hours: 0
minutes: 0
seconds: 20
milliseconds: 0
- action: versatile_thermostat.set_window_bypass
metadata: {}
data:
window_bypass: true
target:
entity_id:
- climate.thermostat_bedroom
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- action: climate.set_hvac_mode
metadata: {}
data:
hvac_mode: heat
target:
entity_id:
- climate.thermostat_bedroom
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- action: versatile_thermostat.set_window_bypass
metadata: {}
data:
window_bypass: false
target:
entity_id:
- climate.thermostat_bedroom
mode: single
After HomeAssistant start the automation turns ON the window bypass. To ignore opened window. Then set mode to HEAT. Which tells Versatile Thermostat to turn the heating on, in real. And then turn OFF the window bypass. After some seconds Versatile Thermostat will notice the window is opened and set mode to OFF as if you manually open the window. Once window is closed HEAR mode is automatically restored.
After some seconds Versatile Thermostat will notice the window is opened and set mode to OFF as if you manually open the window.
Great way to solve the issue. The only think is that you will not restore the previous state but it is something valuable as you did. One more thing, is that you seems to run this automation even if window is closed. This will force to heat each time you restart HA. Think about in summer. You will force heating your VTherm after restarting HA.
I did something similar, but I use two automation for mine - one at shutdown which records that the saved HVAC mode is heat and a window is open, then a second at startup that restores everything. The startup automation also needs an extra little "trick" via a switch to temporarily trick VTherm into thinking I've closed the window.
Automations are below for anybody who's interested...
alias: Persist Saved HVAC Mode
description: ""
mode: single
triggers:
- event: shutdown
trigger: homeassistant
conditions:
- condition: state
entity_id: binary_sensor.home_thermostat_doors_and_windows
state: "on"
- condition: state
entity_id: climate.home_thermostat
attribute: saved_hvac_mode
state: heat
actions:
- action: switch.turn_on
metadata: {}
data: {}
target:
entity_id: switch.home_thermostat_saved_hvac_mode
alias: Restore Saved HVAC Mode
description: ""
mode: single
triggers:
- event: start
trigger: homeassistant
conditions:
- condition: state
entity_id: switch.home_thermostat_saved_hvac_mode
state: "on"
actions:
- action: switch.turn_on
metadata: {}
data: {}
target:
entity_id: switch.home_thermostat_force_doors_and_windows_off
- delay:
hours: 0
minutes: 0
seconds: 35
milliseconds: 0
- action: climate.set_hvac_mode
metadata: {}
data:
hvac_mode: heat
target:
entity_id: climate.home_thermostat
- action: switch.turn_off
metadata: {}
data: {}
target:
entity_id: switch.home_thermostat_force_doors_and_windows_off
- action: switch.turn_off
metadata: {}
data: {}
target:
entity_id: switch.home_thermostat_saved_hvac_mode
I'm so sad people have to do some automations to avoid this limitation. The objective of VTherm was precisely to avoid these automations.
After some seconds Versatile Thermostat will notice the window is opened and set mode to OFF as if you manually open the window.
Great way to solve the issue. The only think is that you will not restore the previous state but it is something valuable as you did. One more thing, is that you seems to run this automation even if window is closed. This will force to heat each time you restart HA. Think about in summer. You will force heating your VTherm after restarting HA.
I intentionally simplified the automation YAML as much as possible, just to demonstrate the approach. There are eg. more rooms. And of course also a conditions taking into account heating season and vacations 😉
I'm so sad people have to do some automations to avoid this limitation. The objective of VTherm was precisely to avoid these automations.
It would be great if VTherm could handle this one for us, that's why I thought it might be a bug initially.
However - I can equally understand as a developer myself the position that these are meant to be temporary variables and that persisting them across startup could be a risk, hence I fully understand the "will not fix" decision.
Something that only occurs when Home Assistant restarts is a relative edge case. The only reason I've configured around it is for the reverse of your "think about having the heating stuck on in summer" point above... In winter, if I happen to restart Home Assistant while a door / window is open, the heating is then stuck off until I realise and intervene what's happened and the house gets cold.
t would be great if VTherm could handle this one for us, that's why I thought it might be a bug initially.
I will think more over this. I very rarely have the case of restarting HA with an open window on winter, but I image If you have done automation for this, that means it is a real case.
Maybe one solution is to store also the saved_hvac_mode (before window opens) and window_state and restore it after restart. But if the is closed during the stop of HA, the VTherm will stay off. I'm pretty sure, VTherm will NOT receive an event if there is no window change. So I will have to deal with startup, check current stat of window, compare with the saved one and one trap is that all is not necessary available at startup - specially with battery powered device like window sensor. So I will surely be not able to determine the window state at startup.
All of this sounds like a mess for an edge case. I will think more or if you have ideas don't hesitate.
Hello, I have good news around this topic.
While implementing #585 i ran exactly on the same issue and I have to find a solution. So I have the solution and it is implemented now.
I will release it soon, I wonder if you can give it a try.
It works 👍
Yes I know ;-) I made many tests and It seems to work as expected.
Thank you for your report, it forces me to reconsider the issue !
Version of the custom_component
6.2.9
Configuration
My VTherm attributes are the following:
Describe the bug
I'm trying to:
And I expect:
But I observe this ....
I read the documentation on the README.md file and I don't find any relevant information about this issue.
I have taken a quick look at the code and can see the attribute "saved_hvac_mode" being written to / read from when a window opens and. closes.
I suspect the value of this may be getting reset to "off" as a result of the home assistant restart, meaning when the window is closed, the VTherm restores the incorrect "off" value.