Adjust migrate_entry in axis (#63779)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2022-01-10 09:34:22 +01:00 committed by GitHub
parent 66809464e4
commit 82f91bcd5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,7 +39,7 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
return await device.async_reset()
async def async_migrate_entry(hass, config_entry):
async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Migrate old entry."""
_LOGGER.debug("Migrating from version %s", config_entry.version)
@ -53,8 +53,7 @@ async def async_migrate_entry(hass, config_entry):
config_entry.version = 2
# Normalise MAC address of device which also affects entity unique IDs
if config_entry.version == 2:
old_unique_id = config_entry.unique_id
if config_entry.version == 2 and (old_unique_id := config_entry.unique_id):
new_unique_id = format_mac(old_unique_id)
@callback