Minor helpers cleanup (#34786)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2020-04-28 14:31:25 -07:00
1 parent 28f6e79385
commit 87801d8aca
2 files changed
+20 -8

No files matched your search

+7 -1
View File
@@ -270,9 +270,15 @@ class EntityComponent:
async def async_remove_entity(self, entity_id: str) -> None:
"""Remove an entity managed by one of the platforms."""
found = None
for platform in self._platforms.values():
if entity_id in platform.entities:
await platform.async_remove_entity(entity_id)
found = platform
break
if found:
await found.async_remove_entity(entity_id)
async def async_prepare_reload(self, *, skip_reset: bool = False) -> Optional[dict]:
"""Prepare reloading this entity component.