From 07f3e00f1856f0fb8a38b96bec02c4f4b4a84b64 Mon Sep 17 00:00:00 2001 From: peteS-UK <64092177+peteS-UK@users.noreply.github.com> Date: Fri, 10 Oct 2025 12:36:46 +0100 Subject: [PATCH] Fix for multiple Lyrion Music Server on a single Home Assistant server for Squeezebox (#154081) --- homeassistant/components/squeezebox/__init__.py | 7 +++++-- homeassistant/components/squeezebox/button.py | 4 +++- homeassistant/components/squeezebox/coordinator.py | 4 +++- homeassistant/components/squeezebox/media_player.py | 4 +++- homeassistant/components/squeezebox/switch.py | 4 +++- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/squeezebox/__init__.py b/homeassistant/components/squeezebox/__init__.py index c7411e935df..25c7aa36d15 100644 --- a/homeassistant/components/squeezebox/__init__.py +++ b/homeassistant/components/squeezebox/__init__.py @@ -196,7 +196,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: SqueezeboxConfigEntry) - if player.player_id in entry.runtime_data.known_player_ids: await player.async_update() async_dispatcher_send( - hass, SIGNAL_PLAYER_REDISCOVERED, player.player_id, player.connected + hass, + SIGNAL_PLAYER_REDISCOVERED + entry.entry_id, + player.player_id, + player.connected, ) else: _LOGGER.debug("Adding new entity: %s", player) @@ -206,7 +209,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: SqueezeboxConfigEntry) - await player_coordinator.async_refresh() entry.runtime_data.known_player_ids.add(player.player_id) async_dispatcher_send( - hass, SIGNAL_PLAYER_DISCOVERED, player_coordinator + hass, SIGNAL_PLAYER_DISCOVERED + entry.entry_id, player_coordinator ) if players := await lms.async_get_players(): diff --git a/homeassistant/components/squeezebox/button.py b/homeassistant/components/squeezebox/button.py index 887151036aa..788eea8f1bc 100644 --- a/homeassistant/components/squeezebox/button.py +++ b/homeassistant/components/squeezebox/button.py @@ -132,7 +132,9 @@ async def async_setup_entry( async_add_entities(entities) entry.async_on_unload( - async_dispatcher_connect(hass, SIGNAL_PLAYER_DISCOVERED, _player_discovered) + async_dispatcher_connect( + hass, SIGNAL_PLAYER_DISCOVERED + entry.entry_id, _player_discovered + ) ) diff --git a/homeassistant/components/squeezebox/coordinator.py b/homeassistant/components/squeezebox/coordinator.py index 9508420ec5f..c078fc377b5 100644 --- a/homeassistant/components/squeezebox/coordinator.py +++ b/homeassistant/components/squeezebox/coordinator.py @@ -117,7 +117,9 @@ class SqueezeBoxPlayerUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]): # start listening for restored players self._remove_dispatcher = async_dispatcher_connect( - self.hass, SIGNAL_PLAYER_REDISCOVERED, self.rediscovered + self.hass, + SIGNAL_PLAYER_REDISCOVERED + self.config_entry.entry_id, + self.rediscovered, ) alarm_dict: dict[str, Alarm] = ( diff --git a/homeassistant/components/squeezebox/media_player.py b/homeassistant/components/squeezebox/media_player.py index 0b9b54a1dcd..1ac08f1b433 100644 --- a/homeassistant/components/squeezebox/media_player.py +++ b/homeassistant/components/squeezebox/media_player.py @@ -175,7 +175,9 @@ async def async_setup_entry( async_add_entities([SqueezeBoxMediaPlayerEntity(coordinator)]) entry.async_on_unload( - async_dispatcher_connect(hass, SIGNAL_PLAYER_DISCOVERED, _player_discovered) + async_dispatcher_connect( + hass, SIGNAL_PLAYER_DISCOVERED + entry.entry_id, _player_discovered + ) ) # Register entity services diff --git a/homeassistant/components/squeezebox/switch.py b/homeassistant/components/squeezebox/switch.py index f8512124068..3e567b6228a 100644 --- a/homeassistant/components/squeezebox/switch.py +++ b/homeassistant/components/squeezebox/switch.py @@ -91,7 +91,9 @@ async def async_setup_entry( async_add_entities([SqueezeBoxAlarmsEnabledEntity(coordinator)]) entry.async_on_unload( - async_dispatcher_connect(hass, SIGNAL_PLAYER_DISCOVERED, _player_discovered) + async_dispatcher_connect( + hass, SIGNAL_PLAYER_DISCOVERED + entry.entry_id, _player_discovered + ) )