With central configuration testu ok
This commit is contained in:
@@ -281,7 +281,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
def clean_one(cfg, schema: vol.Schema):
|
||||
"""Clean one schema"""
|
||||
for key, _ in schema.schema.items():
|
||||
if key in cfg is not None:
|
||||
if key in cfg:
|
||||
del cfg[key]
|
||||
|
||||
cfg = config_entry.copy()
|
||||
@@ -301,7 +301,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
clean_one(cfg, STEP_CENTRAL_WINDOW_DATA_SCHEMA)
|
||||
|
||||
if cfg.get(CONF_USE_MOTION_CENTRAL_CONFIG) is True:
|
||||
clean_one(cfg, STEP_CENTRAL_WINDOW_DATA_SCHEMA)
|
||||
clean_one(cfg, STEP_CENTRAL_MOTION_DATA_SCHEMA)
|
||||
|
||||
if cfg.get(CONF_USE_POWER_CENTRAL_CONFIG) is True:
|
||||
clean_one(cfg, STEP_CENTRAL_POWER_DATA_SCHEMA)
|
||||
|
||||
@@ -80,6 +80,7 @@ async def async_setup_entry(
|
||||
async_add_entities([entity], True)
|
||||
|
||||
# Add services
|
||||
# TODO move this to async_setup ?
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_PRESENCE,
|
||||
|
||||
@@ -127,7 +127,8 @@ class VersatileThermostatBaseConfigFlow(FlowHandler):
|
||||
else:
|
||||
self._infos[config] = self._central_config is not None
|
||||
|
||||
self._infos[COMES_FROM] = None
|
||||
if COMES_FROM in self._infos:
|
||||
del self._infos[COMES_FROM]
|
||||
|
||||
async def validate_input(self, data: dict) -> None:
|
||||
"""Validate the user input allows us to connect.
|
||||
@@ -156,7 +157,7 @@ class VersatileThermostatBaseConfigFlow(FlowHandler):
|
||||
raise UnknownEntity(conf)
|
||||
|
||||
# Check that only one window feature is used
|
||||
ws = data.get(CONF_WINDOW_SENSOR) # pylint: disable=invalid-name
|
||||
ws = self._infos.get(CONF_WINDOW_SENSOR) # pylint: disable=invalid-name
|
||||
waot = data.get(CONF_WINDOW_AUTO_OPEN_THRESHOLD)
|
||||
wact = data.get(CONF_WINDOW_AUTO_CLOSE_THRESHOLD)
|
||||
wamd = data.get(CONF_WINDOW_AUTO_MAX_DURATION)
|
||||
@@ -315,6 +316,8 @@ class VersatileThermostatBaseConfigFlow(FlowHandler):
|
||||
if self._infos[CONF_THERMOSTAT_TYPE] == CONF_THERMOSTAT_CENTRAL_CONFIG:
|
||||
schema = STEP_CENTRAL_TPI_DATA_SCHEMA
|
||||
next_step = self.async_step_presets
|
||||
elif self._infos.get(COMES_FROM) == "async_step_spec_tpi":
|
||||
schema = STEP_CENTRAL_TPI_DATA_SCHEMA
|
||||
|
||||
return await self.generic_step("tpi", schema, user_input, next_step)
|
||||
|
||||
@@ -323,6 +326,7 @@ class VersatileThermostatBaseConfigFlow(FlowHandler):
|
||||
_LOGGER.debug("Into ConfigFlow.async_step_spec_tpi user_input=%s", user_input)
|
||||
|
||||
schema = STEP_CENTRAL_TPI_DATA_SCHEMA
|
||||
self._infos[COMES_FROM] = "async_step_spec_tpi"
|
||||
next_step = self.async_step_presets
|
||||
|
||||
return await self.generic_step("tpi", schema, user_input, next_step)
|
||||
@@ -563,7 +567,7 @@ class VersatileThermostatBaseConfigFlow(FlowHandler):
|
||||
|
||||
schema = STEP_CENTRAL_ADVANCED_DATA_SCHEMA
|
||||
|
||||
self._infos[COMES_FROM] = "async_step_spec_presence"
|
||||
self._infos[COMES_FROM] = "async_step_spec_advanced"
|
||||
|
||||
next_step = self.async_step_advanced
|
||||
|
||||
@@ -607,7 +611,8 @@ class VersatileThermostatConfigFlow(
|
||||
"""Finalization of the ConfigEntry creation"""
|
||||
_LOGGER.debug("ConfigFlow.async_finalize")
|
||||
# Removes temporary value
|
||||
self._infos[COMES_FROM] = None
|
||||
if COMES_FROM in self._infos:
|
||||
del self._infos[COMES_FROM]
|
||||
return self.async_create_entry(title=self._infos[CONF_NAME], data=self._infos)
|
||||
|
||||
|
||||
@@ -811,7 +816,8 @@ class VersatileThermostatOptionsFlowHandler(
|
||||
)
|
||||
|
||||
# Removes temporary value
|
||||
self._infos[COMES_FROM] = None
|
||||
if COMES_FROM in self._infos:
|
||||
del self._infos[COMES_FROM]
|
||||
|
||||
self.hass.config_entries.async_update_entry(self.config_entry, data=self._infos)
|
||||
return self.async_create_entry(title=None, data=None)
|
||||
|
||||
@@ -25,7 +25,7 @@ class PropAlgorithm:
|
||||
) -> None:
|
||||
"""Initialisation of the Proportional Algorithm"""
|
||||
_LOGGER.debug(
|
||||
"Creation new PropAlgorithm function_type: %s, tpi_coef_int: %s, tpi_coef_ext: %s, cycle_min:%d, minimal_activation_delay:%d",
|
||||
"Creation new PropAlgorithm function_type: %s, tpi_coef_int: %s, tpi_coef_ext: %s, cycle_min:%d, minimal_activation_delay:%d", # pylint: disable=line-too-long
|
||||
function_type,
|
||||
tpi_coef_int,
|
||||
tpi_coef_ext,
|
||||
|
||||
Reference in New Issue
Block a user