Fix dangling task for homekit (#88289)

This commit is contained in:
Paulus Schoutsen
2023-02-16 23:07:54 -05:00
committed by GitHub
parent baee6b1f5e
commit 3c68907351

View File

@@ -443,7 +443,9 @@ class Camera(HomeAccessory, PyhapCamera):
async def stop(self):
"""Stop any streams when the accessory is stopped."""
for session_info in self.sessions.values():
asyncio.create_task(self.stop_stream(session_info))
self.hass.async_create_background_task(
self.stop_stream(session_info), "homekit.camera-stop-stream"
)
await super().stop()
async def stop_stream(self, session_info):