From 24c2800d67202a7f3ca75915cea44316eae08987 Mon Sep 17 00:00:00 2001 From: danaues Date: Fri, 28 Oct 2022 02:27:37 +0000 Subject: [PATCH] fix missing configured light entries in options --- custom_components/adaptive_lighting/config_flow.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/custom_components/adaptive_lighting/config_flow.py b/custom_components/adaptive_lighting/config_flow.py index d0f0bf2d..e30ccc63 100644 --- a/custom_components/adaptive_lighting/config_flow.py +++ b/custom_components/adaptive_lighting/config_flow.py @@ -14,7 +14,7 @@ NONE_STR, VALIDATION_TUPLES, ) -from .switch import _supported_features +from .switch import _supported_features, validate _LOGGER = logging.getLogger(__name__) @@ -82,6 +82,7 @@ def __init__(self, config_entry: config_entries.ConfigEntry): async def async_step_init(self, user_input=None): """Handle options flow.""" conf = self.config_entry + data = validate(conf) if conf.source == config_entries.SOURCE_IMPORT: return self.async_show_form(step_id="init", data_schema=None) errors = {} @@ -95,6 +96,9 @@ async def async_step_init(self, user_input=None): for light in self.hass.states.async_entity_ids("light") if _supported_features(self.hass, light) ] + for configured_light in data[CONF_LIGHTS]: + if not configured_light in all_lights: + all_lights.append(configured_light) to_replace = {CONF_LIGHTS: cv.multi_select(sorted(all_lights))} options_schema = {}