Make sure entity platform services work for all platforms of d… (#33176)

* Make sure entity platform services work for all platforms of domain

* Register a bad service handler

* Fix cleaning up

* Tiny cleanup
This commit is contained in:
Paulus Schoutsen 2020-03-23 12:59:36 -07:00 committed by GitHub
parent 2360fd4141
commit 1ff245d9c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 9 deletions

View file

@ -254,7 +254,13 @@ class EntityComponent:
This method must be run in the event loop.
"""
tasks = [platform.async_reset() for platform in self._platforms.values()]
tasks = []
for key, platform in self._platforms.items():
if key == self.domain:
tasks.append(platform.async_reset())
else:
tasks.append(platform.async_destroy())
if tasks:
await asyncio.wait(tasks)