This commit is contained in:
Home Assistant Version Control
2026-08-12 19:11:00 +00:00
parent b654759146
commit 2218539a12
76 changed files with 443 additions and 100 deletions
@@ -13,6 +13,7 @@ from .const import (
HVAC_OFF_REASON_AUTO_START_STOP,
HVAC_OFF_REASON_SLEEP_MODE,
HVAC_OFF_REASON_CENTRAL_MODE,
AUTO_START_STOP_HVAC_MODE_REASONS,
CONF_WINDOW_ECO_TEMP,
CONF_WINDOW_FAN_ONLY,
CONF_WINDOW_FROST_TEMP,
@@ -112,13 +113,16 @@ class StateManager:
if vtherm.last_central_mode == CENTRAL_MODE_STOPPED:
self._current_state.set_hvac_mode(VThermHvacMode_OFF)
vtherm.set_hvac_off_reason(HVAC_OFF_REASON_CENTRAL_MODE)
vtherm.set_hvac_mode_reason(HVAC_OFF_REASON_CENTRAL_MODE)
elif vtherm.safety_manager.is_safety_detected and (vtherm.is_over_climate or vtherm.safety_manager.safety_default_on_percent <= 0.0):
self._current_state.set_hvac_mode(VThermHvacMode_OFF)
vtherm.set_hvac_off_reason(HVAC_OFF_REASON_SAFETY)
vtherm.set_hvac_mode_reason(HVAC_OFF_REASON_SAFETY)
# then check if window is open
elif vtherm.window_manager.is_window_detected and self._requested_state.hvac_mode != VThermHvacMode_OFF:
vtherm.set_hvac_mode_reason(HVAC_OFF_REASON_WINDOW_DETECTION)
if vtherm.window_manager.window_action == CONF_WINDOW_FAN_ONLY and VThermHvacMode_FAN_ONLY in vtherm.vtherm_hvac_modes:
self._current_state.set_hvac_mode(VThermHvacMode_FAN_ONLY)
elif vtherm.window_manager.window_action == CONF_WINDOW_TURN_OFF or (
@@ -128,10 +132,17 @@ class StateManager:
vtherm.set_hvac_off_reason(HVAC_OFF_REASON_WINDOW_DETECTION)
elif vtherm.auto_start_stop_manager and vtherm.auto_start_stop_manager.is_auto_stop_detected and self._requested_state.hvac_mode != VThermHvacMode_OFF:
self._current_state.set_hvac_mode(VThermHvacMode_OFF)
vtherm.set_hvac_off_reason(HVAC_OFF_REASON_AUTO_START_STOP)
stop_mode = vtherm.auto_start_stop_manager.stop_mode
if stop_mode != VThermHvacMode_OFF and stop_mode in vtherm.vtherm_hvac_modes:
self._current_state.set_hvac_mode(stop_mode)
vtherm.set_hvac_mode_reason(AUTO_START_STOP_HVAC_MODE_REASONS.get(str(stop_mode), HVAC_OFF_REASON_AUTO_START_STOP))
else:
self._current_state.set_hvac_mode(VThermHvacMode_OFF)
vtherm.set_hvac_off_reason(HVAC_OFF_REASON_AUTO_START_STOP)
vtherm.set_hvac_mode_reason(HVAC_OFF_REASON_AUTO_START_STOP)
elif vtherm.last_central_mode == CENTRAL_MODE_COOL_ONLY and self._requested_state.hvac_mode != VThermHvacMode_OFF:
vtherm.set_hvac_mode_reason(HVAC_OFF_REASON_CENTRAL_MODE)
if VThermHvacMode_COOL in vtherm.vtherm_hvac_modes:
self._current_state.set_hvac_mode(VThermHvacMode_COOL)
else:
@@ -139,6 +150,7 @@ class StateManager:
self._current_state.set_hvac_mode(VThermHvacMode_OFF)
elif vtherm.last_central_mode == CENTRAL_MODE_HEAT_ONLY and self._requested_state.hvac_mode != VThermHvacMode_OFF:
vtherm.set_hvac_mode_reason(HVAC_OFF_REASON_CENTRAL_MODE)
if VThermHvacMode_HEAT in vtherm.vtherm_hvac_modes:
self._current_state.set_hvac_mode(VThermHvacMode_HEAT)
else:
@@ -146,6 +158,7 @@ class StateManager:
self._current_state.set_hvac_mode(VThermHvacMode_OFF)
elif vtherm.last_central_mode == CENTRAL_MODE_FROST_PROTECTION and self._requested_state.hvac_mode != VThermHvacMode_OFF:
vtherm.set_hvac_mode_reason(HVAC_OFF_REASON_CENTRAL_MODE)
preset_modes = vtherm.vtherm_preset_modes
if preset_modes is None or VThermPreset.FROST not in preset_modes or VThermHvacMode_HEAT not in vtherm.vtherm_hvac_modes:
self._current_state.set_hvac_mode(VThermHvacMode_OFF)
@@ -157,7 +170,11 @@ class StateManager:
else:
if self._current_state.hvac_mode == VThermHvacMode_OFF and self._requested_state.hvac_mode == VThermHvacMode_OFF:
_LOGGER.info("%s - already in OFF. Change the reason to MANUAL", vtherm)
vtherm.set_hvac_off_reason(HVAC_OFF_REASON_MANUAL if not vtherm.is_sleeping else HVAC_OFF_REASON_SLEEP_MODE)
reason = HVAC_OFF_REASON_MANUAL if not vtherm.is_sleeping else HVAC_OFF_REASON_SLEEP_MODE
vtherm.set_hvac_off_reason(reason)
vtherm.set_hvac_mode_reason(reason)
else:
vtherm.set_hvac_mode_reason(None)
self._current_state.set_hvac_mode(self._requested_state.hvac_mode)
@@ -166,6 +183,7 @@ class StateManager:
vtherm.set_hvac_off_reason(None)
elif self._current_state.hvac_mode == VThermHvacMode_SLEEP:
vtherm.set_hvac_off_reason(HVAC_OFF_REASON_SLEEP_MODE)
vtherm.set_hvac_mode_reason(HVAC_OFF_REASON_SLEEP_MODE)
return self._current_state.is_hvac_mode_changed