mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Migrate minecraft_server to use async_update_entry to alter config entries (#110367)
This commit is contained in:
parent
f5497cb0be
commit
96850c6524
@ -86,9 +86,7 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
|
|||||||
|
|
||||||
# Migrate config entry.
|
# Migrate config entry.
|
||||||
_LOGGER.debug("Migrating config entry. Resetting unique ID: %s", old_unique_id)
|
_LOGGER.debug("Migrating config entry. Resetting unique ID: %s", old_unique_id)
|
||||||
config_entry.unique_id = None
|
hass.config_entries.async_update_entry(config_entry, unique_id=None, version=2)
|
||||||
config_entry.version = 2
|
|
||||||
hass.config_entries.async_update_entry(config_entry)
|
|
||||||
|
|
||||||
# Migrate device.
|
# Migrate device.
|
||||||
await _async_migrate_device_identifiers(hass, config_entry, old_unique_id)
|
await _async_migrate_device_identifiers(hass, config_entry, old_unique_id)
|
||||||
@ -142,8 +140,7 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
|
|||||||
new_data[CONF_ADDRESS] = address
|
new_data[CONF_ADDRESS] = address
|
||||||
del new_data[CONF_HOST]
|
del new_data[CONF_HOST]
|
||||||
del new_data[CONF_PORT]
|
del new_data[CONF_PORT]
|
||||||
config_entry.version = 3
|
hass.config_entries.async_update_entry(config_entry, data=new_data, version=3)
|
||||||
hass.config_entries.async_update_entry(config_entry, data=new_data)
|
|
||||||
|
|
||||||
_LOGGER.debug("Migration to version 3 successful")
|
_LOGGER.debug("Migration to version 3 successful")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user