Drop use of initialize_options in onkyo (#129869)

* Drop use of initialize_options in onkyo

* Apply suggestions from code review

Co-authored-by: Artur Pragacz <49985303+arturpragacz@users.noreply.github.com>

---------

Co-authored-by: Artur Pragacz <49985303+arturpragacz@users.noreply.github.com>
This commit is contained in:
epenet 2024-11-05 08:56:58 +01:00 committed by GitHub
parent f7ce4ff25c
commit e1e731eb48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -327,10 +327,8 @@ class OnkyoOptionsFlowHandler(OptionsFlow):
def __init__(self, config_entry: ConfigEntry) -> None: def __init__(self, config_entry: ConfigEntry) -> None:
"""Initialize options flow.""" """Initialize options flow."""
self.initialize_options(config_entry) sources_store: dict[str, str] = config_entry.options[OPTION_INPUT_SOURCES]
sources_store: dict[str, str] = self.options[OPTION_INPUT_SOURCES] self._input_sources = {InputSource(k): v for k, v in sources_store.items()}
sources = {InputSource(k): v for k, v in sources_store.items()}
self.options[OPTION_INPUT_SOURCES] = sources
async def async_step_init( async def async_step_init(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
@ -360,15 +358,12 @@ class OnkyoOptionsFlowHandler(OptionsFlow):
) )
) )
sources: dict[InputSource, str] = self.options[OPTION_INPUT_SOURCES] for source, source_name in self._input_sources.items():
for source in sources: schema_dict[vol.Required(source.value_meaning, default=source_name)] = (
schema_dict[vol.Required(source.value_meaning, default=sources[source])] = (
TextSelector() TextSelector()
) )
schema = vol.Schema(schema_dict)
return self.async_show_form( return self.async_show_form(
step_id="init", step_id="init",
data_schema=schema, data_schema=vol.Schema(schema_dict),
) )