Use new helper properties in watttime options flow (#129789)

This commit is contained in:
epenet 2024-11-04 09:38:24 +01:00 committed by GitHub
parent 0883b23d0c
commit 6a22a2b867
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -126,9 +126,11 @@ class WattTimeConfigFlow(ConfigFlow, domain=DOMAIN):
@staticmethod
@callback
def async_get_options_flow(config_entry: ConfigEntry) -> OptionsFlow:
def async_get_options_flow(
config_entry: ConfigEntry,
) -> WattTimeOptionsFlowHandler:
"""Define the config flow to handle options."""
return WattTimeOptionsFlowHandler(config_entry)
return WattTimeOptionsFlowHandler()
async def async_step_coordinates(
self, user_input: dict[str, Any] | None = None
@ -241,10 +243,6 @@ class WattTimeConfigFlow(ConfigFlow, domain=DOMAIN):
class WattTimeOptionsFlowHandler(OptionsFlow):
"""Handle a WattTime options flow."""
def __init__(self, entry: ConfigEntry) -> None:
"""Initialize."""
self.entry = entry
async def async_step_init(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
@ -258,7 +256,7 @@ class WattTimeOptionsFlowHandler(OptionsFlow):
{
vol.Required(
CONF_SHOW_ON_MAP,
default=self.entry.options.get(CONF_SHOW_ON_MAP, True),
default=self.config_entry.options.get(CONF_SHOW_ON_MAP, True),
): bool
}
),