Fix dangling task for squeezebox (#88299)
This commit is contained in:
parent
99c904ea5d
commit
d866b0ddcb
1 changed files with 4 additions and 3 deletions
|
@ -1,7 +1,6 @@
|
||||||
"""Support for interfacing to the Logitech SqueezeBox API."""
|
"""Support for interfacing to the Logitech SqueezeBox API."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@ -170,7 +169,9 @@ async def async_setup_entry(
|
||||||
] = async_call_later(hass, DISCOVERY_INTERVAL, _discovery)
|
] = async_call_later(hass, DISCOVERY_INTERVAL, _discovery)
|
||||||
|
|
||||||
_LOGGER.debug("Adding player discovery job for LMS server: %s", host)
|
_LOGGER.debug("Adding player discovery job for LMS server: %s", host)
|
||||||
asyncio.create_task(_discovery())
|
config_entry.async_create_background_task(
|
||||||
|
hass, _discovery(), "squeezebox.media_player.discovery"
|
||||||
|
)
|
||||||
|
|
||||||
# Register entity services
|
# Register entity services
|
||||||
platform = entity_platform.async_get_current_platform()
|
platform = entity_platform.async_get_current_platform()
|
||||||
|
@ -203,7 +204,7 @@ async def async_setup_entry(
|
||||||
|
|
||||||
# Start server discovery task if not already running
|
# Start server discovery task if not already running
|
||||||
if hass.is_running:
|
if hass.is_running:
|
||||||
asyncio.create_task(start_server_discovery(hass))
|
hass.async_create_task(start_server_discovery(hass))
|
||||||
else:
|
else:
|
||||||
hass.bus.async_listen_once(
|
hass.bus.async_listen_once(
|
||||||
EVENT_HOMEASSISTANT_START, start_server_discovery(hass)
|
EVENT_HOMEASSISTANT_START, start_server_discovery(hass)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue