mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Use async_start_reauth in blink (#129281)
This commit is contained in:
parent
9bf0cbd659
commit
87f2a4242e
@ -10,7 +10,6 @@ from blinkpy.blinkpy import Blink
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components import persistent_notification
|
from homeassistant.components import persistent_notification
|
||||||
from homeassistant.config_entries import SOURCE_REAUTH
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_FILE_PATH,
|
CONF_FILE_PATH,
|
||||||
CONF_FILENAME,
|
CONF_FILENAME,
|
||||||
@ -41,13 +40,11 @@ SERVICE_SAVE_RECENT_CLIPS_SCHEMA = vol.Schema(
|
|||||||
CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
|
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."""
|
"""Reauth flow wrapper."""
|
||||||
hass.add_job(
|
entry.async_start_reauth(hass, data=data)
|
||||||
hass.config_entries.flow.async_init(
|
|
||||||
DOMAIN, context={"source": SOURCE_REAUTH}, data=data
|
|
||||||
)
|
|
||||||
)
|
|
||||||
persistent_notification.async_create(
|
persistent_notification.async_create(
|
||||||
hass,
|
hass,
|
||||||
(
|
(
|
||||||
@ -64,10 +61,10 @@ async def async_migrate_entry(hass: HomeAssistant, entry: BlinkConfigEntry) -> b
|
|||||||
data = {**entry.data}
|
data = {**entry.data}
|
||||||
if entry.version == 1:
|
if entry.version == 1:
|
||||||
data.pop("login_response", None)
|
data.pop("login_response", None)
|
||||||
await _reauth_flow_wrapper(hass, data)
|
await _reauth_flow_wrapper(hass, entry, data)
|
||||||
return False
|
return False
|
||||||
if entry.version == 2:
|
if entry.version == 2:
|
||||||
await _reauth_flow_wrapper(hass, data)
|
await _reauth_flow_wrapper(hass, entry, data)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user