From 96850c6524038899592f37cd7a0760f574684334 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 12 Feb 2024 12:57:27 -0600 Subject: [PATCH] Migrate minecraft_server to use async_update_entry to alter config entries (#110367) --- homeassistant/components/minecraft_server/__init__.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/minecraft_server/__init__.py b/homeassistant/components/minecraft_server/__init__.py index 0e2debda33e..6c854750baa 100644 --- a/homeassistant/components/minecraft_server/__init__.py +++ b/homeassistant/components/minecraft_server/__init__.py @@ -86,9 +86,7 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> # Migrate config entry. _LOGGER.debug("Migrating config entry. Resetting unique ID: %s", old_unique_id) - config_entry.unique_id = None - config_entry.version = 2 - hass.config_entries.async_update_entry(config_entry) + hass.config_entries.async_update_entry(config_entry, unique_id=None, version=2) # Migrate device. 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 del new_data[CONF_HOST] del new_data[CONF_PORT] - config_entry.version = 3 - hass.config_entries.async_update_entry(config_entry, data=new_data) + hass.config_entries.async_update_entry(config_entry, data=new_data, version=3) _LOGGER.debug("Migration to version 3 successful")