mirror of https://github.com/home-assistant/core
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):
|
||||
"""Handle migration of a previous version config entry."""
|
||||
_LOGGER.debug("Migrating from version %s", entry.version)
|
||||
data = {**entry.data}
|
||||
if entry.version == 1:
|
||||
data.pop("login_response", None)
|
||||
await hass.async_add_executor_job(_reauth_flow_wrapper, hass, data)
|
||||
return False
|
||||
if entry.version == 2:
|
||||
await hass.async_add_executor_job(_reauth_flow_wrapper, hass, data)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
|
@ -148,7 +152,7 @@ async def async_unload_entry(hass, entry):
|
|||
return True
|
||||
|
||||
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)
|
||||
|
||||
return True
|
||||
|
|
|
@ -44,7 +44,7 @@ def _send_blink_2fa_pin(auth, pin):
|
|||
class BlinkConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
"""Handle a Blink config flow."""
|
||||
|
||||
VERSION = 2
|
||||
VERSION = 3
|
||||
CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL
|
||||
|
||||
def __init__(self):
|
||||
|
|
|
@ -273,7 +273,7 @@ async def test_options_flow(hass):
|
|||
data={"username": "blink@example.com", "password": "example"},
|
||||
options={},
|
||||
entry_id=1,
|
||||
version=2,
|
||||
version=3,
|
||||
)
|
||||
config_entry.add_to_hass(hass)
|
||||
|
||||
|
|
Loading…
Reference in New Issue