Use async_start_reauth in blink (#129281)
This commit is contained in:
parent
9bf0cbd659
commit
87f2a4242e
1 changed files with 6 additions and 9 deletions
|
@ -10,7 +10,6 @@ from blinkpy.blinkpy import Blink
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import persistent_notification
|
||||
from homeassistant.config_entries import SOURCE_REAUTH
|
||||
from homeassistant.const import (
|
||||
CONF_FILE_PATH,
|
||||
CONF_FILENAME,
|
||||
|
@ -41,13 +40,11 @@ SERVICE_SAVE_RECENT_CLIPS_SCHEMA = vol.Schema(
|
|||
CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
|
||||
|
||||
|
||||
async def _reauth_flow_wrapper(hass: HomeAssistant, data: dict[str, Any]) -> None:
|
||||
async def _reauth_flow_wrapper(
|
||||
hass: HomeAssistant, entry: BlinkConfigEntry, data: dict[str, Any]
|
||||
) -> None:
|
||||
"""Reauth flow wrapper."""
|
||||
hass.add_job(
|
||||
hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_REAUTH}, data=data
|
||||
)
|
||||
)
|
||||
entry.async_start_reauth(hass, data=data)
|
||||
persistent_notification.async_create(
|
||||
hass,
|
||||
(
|
||||
|
@ -64,10 +61,10 @@ async def async_migrate_entry(hass: HomeAssistant, entry: BlinkConfigEntry) -> b
|
|||
data = {**entry.data}
|
||||
if entry.version == 1:
|
||||
data.pop("login_response", None)
|
||||
await _reauth_flow_wrapper(hass, data)
|
||||
await _reauth_flow_wrapper(hass, entry, data)
|
||||
return False
|
||||
if entry.version == 2:
|
||||
await _reauth_flow_wrapper(hass, data)
|
||||
await _reauth_flow_wrapper(hass, entry, data)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue