Ignore loading system entity category (#71361)

pull/71377/head
Paulus Schoutsen 2022-05-05 14:33:37 -07:00 committed by GitHub
parent 353cc0b8c2
commit c8f95b7dfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -711,6 +711,10 @@ class EntityRegistry:
if not valid_entity_id(entity["entity_id"]):
continue
# We removed this in 2022.5. Remove this check in 2023.1.
if entity["entity_category"] == "system":
entity["entity_category"] = None
entities[entity["entity_id"]] = RegistryEntry(
area_id=entity["area_id"],
capabilities=entity["capabilities"],

View File

@ -297,6 +297,12 @@ async def test_loading_extra_values(hass, hass_storage):
"unique_id": "invalid-hass",
"disabled_by": er.RegistryEntryDisabler.HASS,
},
{
"entity_id": "test.system_entity",
"platform": "super_platform",
"unique_id": "system-entity",
"entity_category": "system",
},
]
},
}
@ -304,7 +310,7 @@ async def test_loading_extra_values(hass, hass_storage):
await er.async_load(hass)
registry = er.async_get(hass)
assert len(registry.entities) == 4
assert len(registry.entities) == 5
entry_with_name = registry.async_get_or_create(
"test", "super_platform", "with-name"
@ -327,6 +333,11 @@ async def test_loading_extra_values(hass, hass_storage):
assert entry_disabled_user.disabled
assert entry_disabled_user.disabled_by is er.RegistryEntryDisabler.USER
entry_system_category = registry.async_get_or_create(
"test", "system_entity", "system-entity"
)
assert entry_system_category.entity_category is None
def test_async_get_entity_id(registry):
"""Test that entity_id is returned."""