diff --git a/custom_components/versatile_thermostat/config_flow.py b/custom_components/versatile_thermostat/config_flow.py index deda5de..ba8cc64 100644 --- a/custom_components/versatile_thermostat/config_flow.py +++ b/custom_components/versatile_thermostat/config_flow.py @@ -242,6 +242,14 @@ class VersatileThermostatBaseConfigFlow(FlowHandler): and infos.get(CONF_PRESENCE_SENSOR, None) is None ): return False + + if self._infos[CONF_USE_CENTRAL_BOILER_FEATURE] and ( + not self._infos.get(CONF_CENTRAL_BOILER_ACTIVATION_SRV, False) + or len(self._infos.get(CONF_CENTRAL_BOILER_ACTIVATION_SRV)) <= 0 + or not self._infos.get(CONF_CENTRAL_BOILER_DEACTIVATION_SRV, False) + or len(self._infos.get(CONF_CENTRAL_BOILER_DEACTIVATION_SRV)) <= 0 + ): + return False else: if ( infos.get(CONF_NAME) is None @@ -857,6 +865,9 @@ class VersatileThermostatOptionsFlowHandler( if not self._infos[CONF_USE_PRESENCE_FEATURE]: self._infos[CONF_USE_PRESENCE_CENTRAL_CONFIG] = False self._infos[CONF_PRESENCE_SENSOR] = None + if not self._infos[CONF_USE_CENTRAL_BOILER_FEATURE]: + self._infos[CONF_CENTRAL_BOILER_ACTIVATION_SRV] = None + self._infos[CONF_CENTRAL_BOILER_DEACTIVATION_SRV] = None _LOGGER.info( "Recreating entry %s due to configuration change. New config is now: %s", diff --git a/tests/test_central_config.py b/tests/test_central_config.py index f977278..c8f56f3 100644 --- a/tests/test_central_config.py +++ b/tests/test_central_config.py @@ -94,8 +94,8 @@ async def test_add_a_central_config(hass: HomeAssistant, skip_hass_states_is_sta assert api.nb_active_device_for_boiler_entity is None assert api.nb_active_device_for_boiler is None - assert api.nb_active_device_for_boiler_threshold_entity is not None - assert api.nb_active_device_for_boiler_threshold == 1 # the default value + assert api.nb_active_device_for_boiler_threshold_entity is None + assert api.nb_active_device_for_boiler_threshold is None # @pytest.mark.parametrize("expected_lingering_tasks", [True])