mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
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:
parent
f7ce4ff25c
commit
e1e731eb48
@ -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),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user