Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions homeassistant/helpers/entity_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,12 @@ async def async_load(self) -> None:

if data is not None:
for entity in data["entities"]:
# Some old installations can have some bad entities.
# Filter htem out as they cause errors down the line.
Comment thread
balloob marked this conversation as resolved.
Outdated
# Can be removed in Jan 2021
if not valid_entity_id(entity["entity_id"]):
continue

entities[entity["entity_id"]] = RegistryEntry(
entity_id=entity["entity_id"],
config_entry_id=entity.get("config_entry_id"),
Expand Down
8 changes: 8 additions & 0 deletions tests/helpers/test_entity_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,20 @@ async def test_loading_extra_values(hass, hass_storage):
"unique_id": "disabled-hass",
"disabled_by": "hass",
},
{
"entity_id": "test.invalid__entity",
"platform": "super_platform",
"unique_id": "invalid-hass",
"disabled_by": "hass",
},
]
},
}

registry = await entity_registry.async_get_registry(hass)

assert len(registry.entities) == 4

entry_with_name = registry.async_get_or_create(
"test", "super_platform", "with-name"
)
Expand Down