Use new helper properties in dsmr options flow (#129775)

This commit is contained in:
epenet 2024-11-04 09:43:10 +01:00 committed by GitHub
parent 9155d56190
commit 3a293c6bc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -171,9 +171,11 @@ class DSMRFlowHandler(ConfigFlow, domain=DOMAIN):
@staticmethod @staticmethod
@callback @callback
def async_get_options_flow(config_entry: ConfigEntry) -> DSMROptionFlowHandler: def async_get_options_flow(
config_entry: ConfigEntry,
) -> DSMROptionFlowHandler:
"""Get the options flow for this handler.""" """Get the options flow for this handler."""
return DSMROptionFlowHandler(config_entry) return DSMROptionFlowHandler()
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
@ -311,10 +313,6 @@ class DSMRFlowHandler(ConfigFlow, domain=DOMAIN):
class DSMROptionFlowHandler(OptionsFlow): class DSMROptionFlowHandler(OptionsFlow):
"""Handle options.""" """Handle options."""
def __init__(self, entry: ConfigEntry) -> None:
"""Initialize options flow."""
self.entry = entry
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
) -> ConfigFlowResult: ) -> ConfigFlowResult:
@ -328,7 +326,7 @@ class DSMROptionFlowHandler(OptionsFlow):
{ {
vol.Optional( vol.Optional(
CONF_TIME_BETWEEN_UPDATE, CONF_TIME_BETWEEN_UPDATE,
default=self.entry.options.get( default=self.config_entry.options.get(
CONF_TIME_BETWEEN_UPDATE, DEFAULT_TIME_BETWEEN_UPDATE CONF_TIME_BETWEEN_UPDATE, DEFAULT_TIME_BETWEEN_UPDATE
), ),
): vol.All(vol.Coerce(int), vol.Range(min=0)), ): vol.All(vol.Coerce(int), vol.Range(min=0)),