mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Use _get_reauth_entry in bthome config flow (#127323)
This commit is contained in:
parent
d8d392990d
commit
da0ebbe57c
@ -15,7 +15,7 @@ from homeassistant.components.bluetooth import (
|
|||||||
BluetoothServiceInfoBleak,
|
BluetoothServiceInfoBleak,
|
||||||
async_discovered_service_info,
|
async_discovered_service_info,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlow, ConfigFlowResult
|
||||||
from homeassistant.const import CONF_ADDRESS
|
from homeassistant.const import CONF_ADDRESS
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
@ -161,9 +161,6 @@ class BTHomeConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
self, entry_data: Mapping[str, Any]
|
self, entry_data: Mapping[str, Any]
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle a flow initialized by a reauth event."""
|
"""Handle a flow initialized by a reauth event."""
|
||||||
entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
|
||||||
assert entry is not None
|
|
||||||
|
|
||||||
device: DeviceData = entry_data["device"]
|
device: DeviceData = entry_data["device"]
|
||||||
self._discovered_device = device
|
self._discovered_device = device
|
||||||
|
|
||||||
@ -182,10 +179,10 @@ class BTHomeConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
if bindkey:
|
if bindkey:
|
||||||
data["bindkey"] = bindkey
|
data["bindkey"] = bindkey
|
||||||
|
|
||||||
if entry_id := self.context.get("entry_id"):
|
if self.source == SOURCE_REAUTH:
|
||||||
entry = self.hass.config_entries.async_get_entry(entry_id)
|
return self.async_update_reload_and_abort(
|
||||||
assert entry is not None
|
self._get_reauth_entry(), data=data
|
||||||
return self.async_update_reload_and_abort(entry, data=data)
|
)
|
||||||
|
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=self.context["title_placeholders"]["name"],
|
title=self.context["title_placeholders"]["name"],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user