This commit is contained in:
Jean-Marc Collin
2024-11-27 20:54:08 +00:00
parent 7e7d0c18c2
commit 7c7fdea1f9
2 changed files with 11 additions and 8 deletions

View File

@@ -72,8 +72,8 @@ class VersatileThermostatBaseConfigFlow(FlowHandler):
else:
self._central_config = None
self._init_feature_flags(infos)
self._init_central_config_flags(infos)
self._init_feature_flags(infos)
def _init_feature_flags(self, _):
"""Fix features selection depending to infos"""
@@ -149,14 +149,17 @@ class VersatileThermostatBaseConfigFlow(FlowHandler):
if step_id not in ["type", "valve_regulation", "check_complete"]:
return True
# underlyings_to_check = data if step_id == "type" else self._infos
underlyings_to_check = self._infos # data if step_id == "type" else self._infos
underlyings_to_check = data if step_id == "type" else self._infos
# underlyings_to_check = self._infos # data if step_id == "type" else self._infos
regulation_infos_to_check = (
data if step_id == "valve_regulation" else self._infos
)
ret = True
if self.is_valve_regulation_selected(underlyings_to_check):
if (
self.is_valve_regulation_selected(underlyings_to_check)
and step_id != "type"
):
nb_unders = len(underlyings_to_check.get(CONF_UNDERLYING_LIST))
nb_offset = len(
regulation_infos_to_check.get(CONF_OFFSET_CALIBRATION_LIST, [])
@@ -562,7 +565,6 @@ class VersatileThermostatBaseConfigFlow(FlowHandler):
):
# Remove TPI info
for key in [
PROPORTIONAL_FUNCTION_TPI,
CONF_PROP_FUNCTION,
CONF_TPI_COEF_INT,
CONF_TPI_COEF_EXT,

View File

@@ -407,9 +407,10 @@ async def test_bug_500_1(hass: HomeAssistant, init_vtherm_api) -> None:
flow = VersatileThermostatBaseConfigFlow(config)
assert flow._infos[CONF_USE_WINDOW_FEATURE] is True
assert flow._infos[CONF_USE_POWER_FEATURE] is True
assert flow._infos[CONF_USE_PRESENCE_FEATURE] is True
assert flow._infos[CONF_USE_WINDOW_FEATURE] is False
assert flow._infos[CONF_USE_POWER_FEATURE] is False
assert flow._infos[CONF_USE_PRESENCE_FEATURE] is False
# we have a motion sensor configured
assert flow._infos[CONF_USE_MOTION_FEATURE] is True