mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Add small speed improvement when unloading Ambient PWS (#28756)
This commit is contained in:
parent
8789da36be
commit
c27b94c0e5
@ -1,4 +1,5 @@
|
|||||||
"""Support for Ambient Weather Station Service."""
|
"""Support for Ambient Weather Station Service."""
|
||||||
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from aioambient import Client
|
from aioambient import Client
|
||||||
@ -297,8 +298,12 @@ async def async_unload_entry(hass, config_entry):
|
|||||||
ambient = hass.data[DOMAIN][DATA_CLIENT].pop(config_entry.entry_id)
|
ambient = hass.data[DOMAIN][DATA_CLIENT].pop(config_entry.entry_id)
|
||||||
hass.async_create_task(ambient.ws_disconnect())
|
hass.async_create_task(ambient.ws_disconnect())
|
||||||
|
|
||||||
for component in ("binary_sensor", "sensor"):
|
tasks = [
|
||||||
await hass.config_entries.async_forward_entry_unload(config_entry, component)
|
hass.config_entries.async_forward_entry_unload(config_entry, component)
|
||||||
|
for component in ("binary_sensor", "sensor")
|
||||||
|
]
|
||||||
|
|
||||||
|
await asyncio.gather(*tasks)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user