diff --git a/homeassistant/components/tag/__init__.py b/homeassistant/components/tag/__init__.py index 95efae3d386..47c1d14ce60 100644 --- a/homeassistant/components/tag/__init__.py +++ b/homeassistant/components/tag/__init__.py @@ -106,7 +106,6 @@ class TagStore(Store[collection.SerializedStorageCollection]): for tag in data["items"]: # Copy name in tag store to the entity registry _create_entry(entity_registry, tag[CONF_ID], tag.get(CONF_NAME)) - tag["migrated"] = True if old_major_version == 1 and old_minor_version < 3: # Version 1.3 removes tag_id from the store for tag in data["items"]: @@ -178,10 +177,7 @@ class TagStorageCollection(collection.DictStorageCollection): We don't store the name, it's stored in the entity registry. """ - # Preserve the name of migrated entries to allow downgrading to 2024.5 - # without losing tag names. This can be removed in HA Core 2025.1. - migrated = item_id in self.data and "migrated" in self.data[item_id] - return {k: v for k, v in item.items() if k != CONF_NAME or migrated} + return {k: v for k, v in item.items() if k != CONF_NAME} class TagDictStorageCollectionWebsocket( diff --git a/tests/components/tag/snapshots/test_init.ambr b/tests/components/tag/snapshots/test_init.ambr index 29a9a2665b8..caa88b8ca9a 100644 --- a/tests/components/tag/snapshots/test_init.ambr +++ b/tests/components/tag/snapshots/test_init.ambr @@ -5,8 +5,6 @@ 'items': list([ dict({ 'id': 'test tag id', - 'migrated': True, - 'name': 'test tag name', }), dict({ 'device_id': 'some_scanner', @@ -23,3 +21,24 @@ 'version': 1, }) # --- +# name: test_tag_scanned + dict({ + 'data': dict({ + 'items': list([ + dict({ + 'id': 'test tag id', + }), + dict({ + 'id': 'test tag id 2', + }), + dict({ + 'device_id': 'some_scanner', + 'id': 'new tag', + }), + ]), + }), + 'key': 'tag', + 'minor_version': 3, + 'version': 1, + }) +# --- diff --git a/tests/components/tag/test_init.py b/tests/components/tag/test_init.py index 5c1e80c2d8b..ac862e59f2d 100644 --- a/tests/components/tag/test_init.py +++ b/tests/components/tag/test_init.py @@ -6,6 +6,7 @@ from typing import Any from freezegun.api import FrozenDateTimeFactory import pytest from syrupy import SnapshotAssertion +from syrupy.filters import props from homeassistant.components.tag import DOMAIN, _create_entry, async_scan_tag from homeassistant.const import CONF_NAME, STATE_UNKNOWN @@ -165,7 +166,9 @@ async def test_tag_scanned( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, freezer: FrozenDateTimeFactory, + hass_storage: dict[str, Any], storage_setup, + snapshot: SnapshotAssertion, ) -> None: """Test scanning tags.""" assert await storage_setup() @@ -205,6 +208,12 @@ async def test_tag_scanned( }, ] + # Trigger store + freezer.tick(11) + async_fire_time_changed(hass) + await hass.async_block_till_done() + assert hass_storage[DOMAIN] == snapshot(exclude=props("last_scanned")) + def track_changes(coll: collection.ObservableCollection): """Create helper to track changes in a collection."""