mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 01:07:10 +00:00
Ignore loading system entity category (#71361)
This commit is contained in:
parent
353cc0b8c2
commit
c8f95b7dfc
@ -711,6 +711,10 @@ class EntityRegistry:
|
|||||||
if not valid_entity_id(entity["entity_id"]):
|
if not valid_entity_id(entity["entity_id"]):
|
||||||
continue
|
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(
|
entities[entity["entity_id"]] = RegistryEntry(
|
||||||
area_id=entity["area_id"],
|
area_id=entity["area_id"],
|
||||||
capabilities=entity["capabilities"],
|
capabilities=entity["capabilities"],
|
||||||
|
@ -297,6 +297,12 @@ async def test_loading_extra_values(hass, hass_storage):
|
|||||||
"unique_id": "invalid-hass",
|
"unique_id": "invalid-hass",
|
||||||
"disabled_by": er.RegistryEntryDisabler.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)
|
await er.async_load(hass)
|
||||||
registry = er.async_get(hass)
|
registry = er.async_get(hass)
|
||||||
|
|
||||||
assert len(registry.entities) == 4
|
assert len(registry.entities) == 5
|
||||||
|
|
||||||
entry_with_name = registry.async_get_or_create(
|
entry_with_name = registry.async_get_or_create(
|
||||||
"test", "super_platform", "with-name"
|
"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
|
||||||
assert entry_disabled_user.disabled_by is er.RegistryEntryDisabler.USER
|
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):
|
def test_async_get_entity_id(registry):
|
||||||
"""Test that entity_id is returned."""
|
"""Test that entity_id is returned."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user