Fix incorrect SimpliSafe websocket disconnect listener (#41923)

This commit is contained in:
Aaron Bach 2020-10-15 22:13:45 -06:00 committed by GitHub
parent 11b812b82e
commit 76f88459dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -449,8 +449,13 @@ class SimpliSafe:
async def async_init(self):
"""Initialize the data class."""
asyncio.create_task(self.websocket.async_connect())
async def async_websocket_disconnect(_):
"""Define an event handler to disconnect from the websocket."""
await self.websocket.async_disconnect()
self._hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, self.websocket.async_disconnect()
EVENT_HOMEASSISTANT_STOP, async_websocket_disconnect
)
self.systems = await self._api.get_systems()