Skip to content

Commit

Permalink
Use start helper in squeezebox for server discovery (#115978)
Browse files Browse the repository at this point in the history
  • Loading branch information
rajlaud authored and frenck committed Apr 23, 2024
1 parent 036b6fc commit b521acb
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions homeassistant/components/squeezebox/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
CONF_PASSWORD,
CONF_PORT,
CONF_USERNAME,
EVENT_HOMEASSISTANT_START,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import (
Expand All @@ -44,6 +43,7 @@
)
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 (
Expand Down Expand Up @@ -207,12 +207,7 @@ async def _discovered_player(player):
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):
Expand Down

0 comments on commit b521acb

Please sign in to comment.