mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 19:09:32 +00:00
Fix for multiple Lyrion Music Server on a single Home Assistant server for Squeezebox (#154081)
This commit is contained in:
@@ -196,7 +196,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: SqueezeboxConfigEntry) -
|
|||||||
if player.player_id in entry.runtime_data.known_player_ids:
|
if player.player_id in entry.runtime_data.known_player_ids:
|
||||||
await player.async_update()
|
await player.async_update()
|
||||||
async_dispatcher_send(
|
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:
|
else:
|
||||||
_LOGGER.debug("Adding new entity: %s", player)
|
_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()
|
await player_coordinator.async_refresh()
|
||||||
entry.runtime_data.known_player_ids.add(player.player_id)
|
entry.runtime_data.known_player_ids.add(player.player_id)
|
||||||
async_dispatcher_send(
|
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():
|
if players := await lms.async_get_players():
|
||||||
|
|||||||
@@ -132,7 +132,9 @@ async def async_setup_entry(
|
|||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
|
||||||
entry.async_on_unload(
|
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
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,9 @@ class SqueezeBoxPlayerUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
|||||||
|
|
||||||
# start listening for restored players
|
# start listening for restored players
|
||||||
self._remove_dispatcher = async_dispatcher_connect(
|
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] = (
|
alarm_dict: dict[str, Alarm] = (
|
||||||
|
|||||||
@@ -175,7 +175,9 @@ async def async_setup_entry(
|
|||||||
async_add_entities([SqueezeBoxMediaPlayerEntity(coordinator)])
|
async_add_entities([SqueezeBoxMediaPlayerEntity(coordinator)])
|
||||||
|
|
||||||
entry.async_on_unload(
|
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
|
# Register entity services
|
||||||
|
|||||||
@@ -91,7 +91,9 @@ async def async_setup_entry(
|
|||||||
async_add_entities([SqueezeBoxAlarmsEnabledEntity(coordinator)])
|
async_add_entities([SqueezeBoxAlarmsEnabledEntity(coordinator)])
|
||||||
|
|
||||||
entry.async_on_unload(
|
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
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user