Use new helper properties in yalexs_ble options flow (#129790)

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

View file

@ -312,16 +312,12 @@ class YalexsConfigFlow(ConfigFlow, domain=DOMAIN):
config_entry: ConfigEntry, config_entry: ConfigEntry,
) -> YaleXSBLEOptionsFlowHandler: ) -> YaleXSBLEOptionsFlowHandler:
"""Get the options flow for this handler.""" """Get the options flow for this handler."""
return YaleXSBLEOptionsFlowHandler(config_entry) return YaleXSBLEOptionsFlowHandler()
class YaleXSBLEOptionsFlowHandler(OptionsFlow): class YaleXSBLEOptionsFlowHandler(OptionsFlow):
"""Handle YaleXSBLE options.""" """Handle YaleXSBLE options."""
def __init__(self, config_entry: ConfigEntry) -> None:
"""Initialize YaleXSBLE options flow."""
self.entry = config_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:
@ -343,7 +339,9 @@ class YaleXSBLEOptionsFlowHandler(OptionsFlow):
{ {
vol.Optional( vol.Optional(
CONF_ALWAYS_CONNECTED, CONF_ALWAYS_CONNECTED,
default=self.entry.options.get(CONF_ALWAYS_CONNECTED, False), default=self.config_entry.options.get(
CONF_ALWAYS_CONNECTED, False
),
): bool, ): bool,
} }
), ),