diff --git a/custom_components/adaptive_lighting/config_flow.py b/custom_components/adaptive_lighting/config_flow.py index b86fe3ea..097ea5be 100644 --- a/custom_components/adaptive_lighting/config_flow.py +++ b/custom_components/adaptive_lighting/config_flow.py @@ -76,6 +76,9 @@ class OptionsFlowHandler(config_entries.OptionsFlow): async def async_step_init(self, user_input=None): """Handle options flow.""" + conf = self.config_entry + if conf.source == config_entries.SOURCE_IMPORT: + return self.async_show_form(step_id="init", data_schema={}) errors = {} if user_input is not None: validate_options(user_input, errors) @@ -87,10 +90,9 @@ class OptionsFlowHandler(config_entries.OptionsFlow): lights_tuple = (*validation_tuples[0][:-1], all_lights) validation_tuples[0] = lights_tuple - options = self.config_entry.options options_schema = vol.Schema( { - vol.Optional(key, default=options.get(key, default)): validation + vol.Optional(key, default=conf.options.get(key, default)): validation for key, default, validation in validation_tuples } ) diff --git a/custom_components/adaptive_lighting/strings.json b/custom_components/adaptive_lighting/strings.json index 0e02634a..13851edd 100644 --- a/custom_components/adaptive_lighting/strings.json +++ b/custom_components/adaptive_lighting/strings.json @@ -18,7 +18,7 @@ "step": { "init": { "title": "Adaptive Lighting options", - "description": "All settings for a Adaptive Lighting component. The option names correspond with the YAML settings.", + "description": "All settings for a Adaptive Lighting component. The option names correspond with the YAML settings. No options are shown if you have this entry defined in YAML.", "data": { "lights_brightness": "lights_brightness", "lights_mired": "lights_mired", diff --git a/custom_components/adaptive_lighting/translations/en.json b/custom_components/adaptive_lighting/translations/en.json index 0e02634a..13851edd 100644 --- a/custom_components/adaptive_lighting/translations/en.json +++ b/custom_components/adaptive_lighting/translations/en.json @@ -18,7 +18,7 @@ "step": { "init": { "title": "Adaptive Lighting options", - "description": "All settings for a Adaptive Lighting component. The option names correspond with the YAML settings.", + "description": "All settings for a Adaptive Lighting component. The option names correspond with the YAML settings. No options are shown if you have this entry defined in YAML.", "data": { "lights_brightness": "lights_brightness", "lights_mired": "lights_mired",