Use start helper in squeezebox for server discovery (#115978)
parent
2afaa3d333
commit
124eca4d53
|
@ -28,7 +28,6 @@ from homeassistant.const import (
|
|||
CONF_PASSWORD,
|
||||
CONF_PORT,
|
||||
CONF_USERNAME,
|
||||
EVENT_HOMEASSISTANT_START,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import (
|
||||
|
@ -44,6 +43,7 @@ from homeassistant.helpers.dispatcher import (
|
|||
)
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.event import async_call_later
|
||||
from homeassistant.helpers.start import async_at_start
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from .browse_media import (
|
||||
|
@ -207,12 +207,7 @@ async def async_setup_entry(
|
|||
platform.async_register_entity_service(SERVICE_UNSYNC, None, "async_unsync")
|
||||
|
||||
# Start server discovery task if not already running
|
||||
if hass.is_running:
|
||||
hass.async_create_task(start_server_discovery(hass))
|
||||
else:
|
||||
hass.bus.async_listen_once(
|
||||
EVENT_HOMEASSISTANT_START, start_server_discovery(hass)
|
||||
)
|
||||
config_entry.async_on_unload(async_at_start(hass, start_server_discovery))
|
||||
|
||||
|
||||
class SqueezeBoxEntity(MediaPlayerEntity):
|
||||
|
|
Loading…
Reference in New Issue