Use new reauth helpers in yalexs_ble (#128831)

pull/128785/head^2
epenet 2024-10-20 15:53:46 +02:00 committed by GitHub
parent 49fafcc68a
commit eed842fff1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 7 deletions

View File

@ -78,7 +78,6 @@ class YalexsConfigFlow(ConfigFlow, domain=DOMAIN):
self._discovery_info: BluetoothServiceInfoBleak | None = None self._discovery_info: BluetoothServiceInfoBleak | None = None
self._discovered_devices: dict[str, BluetoothServiceInfoBleak] = {} self._discovered_devices: dict[str, BluetoothServiceInfoBleak] = {}
self._lock_cfg: ValidatedLockConfig | None = None self._lock_cfg: ValidatedLockConfig | None = None
self._reauth_entry: ConfigEntry | None = None
async def async_step_bluetooth( async def async_step_bluetooth(
self, discovery_info: BluetoothServiceInfoBleak self, discovery_info: BluetoothServiceInfoBleak
@ -194,9 +193,6 @@ class YalexsConfigFlow(ConfigFlow, domain=DOMAIN):
self, entry_data: Mapping[str, Any] self, entry_data: Mapping[str, Any]
) -> ConfigFlowResult: ) -> ConfigFlowResult:
"""Handle configuration by re-auth.""" """Handle configuration by re-auth."""
self._reauth_entry = self.hass.config_entries.async_get_entry(
self.context["entry_id"]
)
return await self.async_step_reauth_validate() return await self.async_step_reauth_validate()
async def async_step_reauth_validate( async def async_step_reauth_validate(
@ -204,8 +200,7 @@ class YalexsConfigFlow(ConfigFlow, domain=DOMAIN):
) -> ConfigFlowResult: ) -> ConfigFlowResult:
"""Handle reauth and validation.""" """Handle reauth and validation."""
errors = {} errors = {}
reauth_entry = self._reauth_entry reauth_entry = self._get_reauth_entry()
assert reauth_entry is not None
if user_input is not None: if user_input is not None:
if ( if (
device := async_ble_device_from_address( device := async_ble_device_from_address(
@ -222,7 +217,7 @@ class YalexsConfigFlow(ConfigFlow, domain=DOMAIN):
) )
): ):
return self.async_update_reload_and_abort( return self.async_update_reload_and_abort(
reauth_entry, data={**reauth_entry.data, **user_input} reauth_entry, data_updates=user_input
) )
return self.async_show_form( return self.async_show_form(