forked from home-assistant/core
Add small speed improvement when unloading Ambient PWS (#28756)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"""Support for Ambient Weather Station Service."""
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
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)
|
||||
hass.async_create_task(ambient.ws_disconnect())
|
||||
|
||||
for component in ("binary_sensor", "sensor"):
|
||||
await hass.config_entries.async_forward_entry_unload(config_entry, component)
|
||||
tasks = [
|
||||
hass.config_entries.async_forward_entry_unload(config_entry, component)
|
||||
for component in ("binary_sensor", "sensor")
|
||||
]
|
||||
|
||||
await asyncio.gather(*tasks)
|
||||
|
||||
return True
|
||||
|
||||
|
Reference in New Issue
Block a user