mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Hold strong references to tasks in WLED (#88257)
This commit is contained in:
parent
fa811da872
commit
2ea5811e3a
@ -1,8 +1,6 @@
|
|||||||
"""DataUpdateCoordinator for WLED."""
|
"""DataUpdateCoordinator for WLED."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
|
|
||||||
from wled import WLED, Device as WLEDDevice, WLEDConnectionClosed, WLEDError
|
from wled import WLED, Device as WLEDDevice, WLEDConnectionClosed, WLEDError
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -95,7 +93,9 @@ class WLEDDataUpdateCoordinator(DataUpdateCoordinator[WLEDDevice]):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Start listening
|
# Start listening
|
||||||
asyncio.create_task(listen())
|
self.config_entry.async_create_background_task(
|
||||||
|
self.hass, listen(), "wled-listen"
|
||||||
|
)
|
||||||
|
|
||||||
async def _async_update_data(self) -> WLEDDevice:
|
async def _async_update_data(self) -> WLEDDevice:
|
||||||
"""Fetch data from WLED."""
|
"""Fetch data from WLED."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user