Skip to content

Commit d9c61a3

Browse files
authored
Use new reauth helpers in xiaomi_ble (#128827)
1 parent 5f66298 commit d9c61a3

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

homeassistant/components/xiaomi_ble/config_flow.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
async_discovered_service_info,
1818
async_process_advertisements,
1919
)
20-
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
20+
from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlow, ConfigFlowResult
2121
from homeassistant.const import CONF_ADDRESS
2222

2323
from .const import DOMAIN
@@ -264,9 +264,6 @@ async def async_step_reauth(
264264
self, entry_data: Mapping[str, Any]
265265
) -> ConfigFlowResult:
266266
"""Handle a flow initialized by a reauth event."""
267-
entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
268-
assert entry is not None
269-
270267
device: DeviceData = entry_data["device"]
271268
self._discovered_device = device
272269

@@ -289,10 +286,10 @@ def _async_get_or_create_entry(
289286
if bindkey:
290287
data["bindkey"] = bindkey
291288

292-
if entry_id := self.context.get("entry_id"):
293-
entry = self.hass.config_entries.async_get_entry(entry_id)
294-
assert entry is not None
295-
return self.async_update_reload_and_abort(entry, data=data)
289+
if self.source == SOURCE_REAUTH:
290+
return self.async_update_reload_and_abort(
291+
self._get_reauth_entry(), data=data
292+
)
296293

297294
return self.async_create_entry(
298295
title=self.context["title_placeholders"]["name"],

0 commit comments

Comments
 (0)