mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Avoid playing queue pollution with Sonos unjoin (#22004)
This commit is contained in:
parent
186b48e2eb
commit
fe5e4b5b9b
@ -1012,7 +1012,11 @@ class SonosEntity(MediaPlayerDevice):
|
|||||||
"""Unjoin several players from their group."""
|
"""Unjoin several players from their group."""
|
||||||
def _unjoin_all(entities):
|
def _unjoin_all(entities):
|
||||||
"""Sync helper."""
|
"""Sync helper."""
|
||||||
for entity in entities:
|
# Unjoin slaves first to prevent inheritance of queues
|
||||||
|
coordinators = [e for e in entities if e.is_coordinator]
|
||||||
|
slaves = [e for e in entities if not e.is_coordinator]
|
||||||
|
|
||||||
|
for entity in slaves + coordinators:
|
||||||
entity.unjoin()
|
entity.unjoin()
|
||||||
|
|
||||||
async with hass.data[DATA_SONOS].topology_lock:
|
async with hass.data[DATA_SONOS].topology_lock:
|
||||||
@ -1079,7 +1083,7 @@ class SonosEntity(MediaPlayerDevice):
|
|||||||
entity.media_pause()
|
entity.media_pause()
|
||||||
|
|
||||||
if with_group:
|
if with_group:
|
||||||
# Unjoin slaves that are not already in their target group
|
# Unjoin slaves first to prevent inheritance of queues
|
||||||
for entity in [e for e in entities if not e.is_coordinator]:
|
for entity in [e for e in entities if not e.is_coordinator]:
|
||||||
if entity._snapshot_group != entity._sonos_group:
|
if entity._snapshot_group != entity._sonos_group:
|
||||||
entity.unjoin()
|
entity.unjoin()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user