Use new helper properties in konnected options flow (#129778)

This commit is contained in:
epenet 2024-11-04 18:50:00 +01:00 committed by GitHub
parent 7fd261347b
commit 81735b7b47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -402,9 +402,10 @@ class OptionsFlowHandler(OptionsFlow):
def __init__(self, config_entry: ConfigEntry) -> None: def __init__(self, config_entry: ConfigEntry) -> None:
"""Initialize options flow.""" """Initialize options flow."""
self.entry = config_entry self.model = config_entry.data[CONF_MODEL]
self.model = self.entry.data[CONF_MODEL] self.current_opt = (
self.current_opt = self.entry.options or self.entry.data[CONF_DEFAULT_OPTIONS] config_entry.options or config_entry.data[CONF_DEFAULT_OPTIONS]
)
# as config proceeds we'll build up new options and then replace what's in the config entry # as config proceeds we'll build up new options and then replace what's in the config entry
self.new_opt: dict[str, Any] = {CONF_IO: {}} self.new_opt: dict[str, Any] = {CONF_IO: {}}
@ -475,7 +476,7 @@ class OptionsFlowHandler(OptionsFlow):
), ),
description_placeholders={ description_placeholders={
"model": KONN_PANEL_MODEL_NAMES[self.model], "model": KONN_PANEL_MODEL_NAMES[self.model],
"host": self.entry.data[CONF_HOST], "host": self.config_entry.data[CONF_HOST],
}, },
errors=errors, errors=errors,
) )
@ -511,7 +512,7 @@ class OptionsFlowHandler(OptionsFlow):
), ),
description_placeholders={ description_placeholders={
"model": KONN_PANEL_MODEL_NAMES[self.model], "model": KONN_PANEL_MODEL_NAMES[self.model],
"host": self.entry.data[CONF_HOST], "host": self.config_entry.data[CONF_HOST],
}, },
errors=errors, errors=errors,
) )
@ -571,7 +572,7 @@ class OptionsFlowHandler(OptionsFlow):
), ),
description_placeholders={ description_placeholders={
"model": KONN_PANEL_MODEL_NAMES[self.model], "model": KONN_PANEL_MODEL_NAMES[self.model],
"host": self.entry.data[CONF_HOST], "host": self.config_entry.data[CONF_HOST],
}, },
errors=errors, errors=errors,
) )