Optimize Sonos unjoin behavior when using media_player.unjoin (#74086)

* Coalesce Sonos unjoins to process together

* Refactor for readability

* Skip unjoin call if already ungrouped

* Store unjoin data in a dedicated dataclass

* Revert import adjustment
This commit is contained in:
jjlawren 2022-06-28 15:19:27 -05:00 committed by GitHub
parent abe44a100f
commit 4bfdb1433e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 4 deletions

View file

@ -906,6 +906,8 @@ class SonosSpeaker:
@soco_error()
def unjoin(self) -> None:
"""Unjoin the player from a group."""
if self.sonos_group == [self]:
return
self.soco.unjoin()
self.coordinator = None