Skip to content

Commit 48a3372

Browse files
peteS-UKfrenck
authored andcommitted
Fix for multiple Lyrion Music Server on a single Home Assistant server for Squeezebox (home-assistant#154081)
1 parent d84fd72 commit 48a3372

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

homeassistant/components/squeezebox/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@ async def _discovered_player(player: Player) -> None:
193193
if player.player_id in entry.runtime_data.known_player_ids:
194194
await player.async_update()
195195
async_dispatcher_send(
196-
hass, SIGNAL_PLAYER_REDISCOVERED, player.player_id, player.connected
196+
hass,
197+
SIGNAL_PLAYER_REDISCOVERED + entry.entry_id,
198+
player.player_id,
199+
player.connected,
197200
)
198201
else:
199202
_LOGGER.debug("Adding new entity: %s", player)
@@ -203,7 +206,7 @@ async def _discovered_player(player: Player) -> None:
203206
await player_coordinator.async_refresh()
204207
entry.runtime_data.known_player_ids.add(player.player_id)
205208
async_dispatcher_send(
206-
hass, SIGNAL_PLAYER_DISCOVERED, player_coordinator
209+
hass, SIGNAL_PLAYER_DISCOVERED + entry.entry_id, player_coordinator
207210
)
208211

209212
if players := await lms.async_get_players():

homeassistant/components/squeezebox/button.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ async def _player_discovered(
132132
async_add_entities(entities)
133133

134134
entry.async_on_unload(
135-
async_dispatcher_connect(hass, SIGNAL_PLAYER_DISCOVERED, _player_discovered)
135+
async_dispatcher_connect(
136+
hass, SIGNAL_PLAYER_DISCOVERED + entry.entry_id, _player_discovered
137+
)
136138
)
137139

138140

homeassistant/components/squeezebox/coordinator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ async def _async_update_data(self) -> dict[str, Any]:
117117

118118
# start listening for restored players
119119
self._remove_dispatcher = async_dispatcher_connect(
120-
self.hass, SIGNAL_PLAYER_REDISCOVERED, self.rediscovered
120+
self.hass,
121+
SIGNAL_PLAYER_REDISCOVERED + self.config_entry.entry_id,
122+
self.rediscovered,
121123
)
122124

123125
alarm_dict: dict[str, Alarm] = (

homeassistant/components/squeezebox/media_player.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ async def _player_discovered(
175175
async_add_entities([SqueezeBoxMediaPlayerEntity(coordinator)])
176176

177177
entry.async_on_unload(
178-
async_dispatcher_connect(hass, SIGNAL_PLAYER_DISCOVERED, _player_discovered)
178+
async_dispatcher_connect(
179+
hass, SIGNAL_PLAYER_DISCOVERED + entry.entry_id, _player_discovered
180+
)
179181
)
180182

181183
# Register entity services

homeassistant/components/squeezebox/switch.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ def _async_listener() -> None:
8989
async_add_entities([SqueezeBoxAlarmsEnabledEntity(coordinator)])
9090

9191
entry.async_on_unload(
92-
async_dispatcher_connect(hass, SIGNAL_PLAYER_DISCOVERED, _player_discovered)
92+
async_dispatcher_connect(
93+
hass, SIGNAL_PLAYER_DISCOVERED + entry.entry_id, _player_discovered
94+
)
9395
)
9496

9597

0 commit comments

Comments
 (0)