mirror of
https://github.com/home-assistant/core
synced 2024-07-27 18:58:57 +02:00
Add Blink config migration (#46671)
This commit is contained in:
parent
fb03d79daf
commit
8900b38c7f
@ -67,11 +67,15 @@ async def async_setup(hass, config):
|
|||||||
|
|
||||||
async def async_migrate_entry(hass, entry):
|
async def async_migrate_entry(hass, entry):
|
||||||
"""Handle migration of a previous version config entry."""
|
"""Handle migration of a previous version config entry."""
|
||||||
|
_LOGGER.debug("Migrating from version %s", entry.version)
|
||||||
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 hass.async_add_executor_job(_reauth_flow_wrapper, hass, data)
|
await hass.async_add_executor_job(_reauth_flow_wrapper, hass, data)
|
||||||
return False
|
return False
|
||||||
|
if entry.version == 2:
|
||||||
|
await hass.async_add_executor_job(_reauth_flow_wrapper, hass, data)
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@ -148,7 +152,7 @@ async def async_unload_entry(hass, entry):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
hass.services.async_remove(DOMAIN, SERVICE_REFRESH)
|
hass.services.async_remove(DOMAIN, SERVICE_REFRESH)
|
||||||
hass.services.async_remove(DOMAIN, SERVICE_SAVE_VIDEO_SCHEMA)
|
hass.services.async_remove(DOMAIN, SERVICE_SAVE_VIDEO)
|
||||||
hass.services.async_remove(DOMAIN, SERVICE_SEND_PIN)
|
hass.services.async_remove(DOMAIN, SERVICE_SEND_PIN)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -44,7 +44,7 @@ def _send_blink_2fa_pin(auth, pin):
|
|||||||
class BlinkConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class BlinkConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a Blink config flow."""
|
"""Handle a Blink config flow."""
|
||||||
|
|
||||||
VERSION = 2
|
VERSION = 3
|
||||||
CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL
|
CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -273,7 +273,7 @@ async def test_options_flow(hass):
|
|||||||
data={"username": "blink@example.com", "password": "example"},
|
data={"username": "blink@example.com", "password": "example"},
|
||||||
options={},
|
options={},
|
||||||
entry_id=1,
|
entry_id=1,
|
||||||
version=2,
|
version=3,
|
||||||
)
|
)
|
||||||
config_entry.add_to_hass(hass)
|
config_entry.add_to_hass(hass)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user