Fix for multiple Lyrion Music Server on a single Home Assistant server for Squeezebox (#154081)

This commit is contained in:
peteS-UK
2025-10-10 12:36:46 +01:00
committed by GitHub
parent 084d029168
commit 07f3e00f18
5 changed files with 17 additions and 6 deletions

View File

@@ -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():

View File

@@ -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
)
)

View File

@@ -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] = (

View File

@@ -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

View File

@@ -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
)
)