mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Fix grouping feature for MusicCast (#95958)
check the current source for grouping using the source ID instead of the label
This commit is contained in:
parent
b7b8afffd0
commit
59645344e7
@ -130,14 +130,11 @@ class MusicCastMediaPlayer(MusicCastDeviceEntity, MediaPlayerEntity):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def _is_netusb(self):
|
def _is_netusb(self):
|
||||||
return (
|
return self.coordinator.data.netusb_input == self.source_id
|
||||||
self.coordinator.data.netusb_input
|
|
||||||
== self.coordinator.data.zones[self._zone_id].input
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _is_tuner(self):
|
def _is_tuner(self):
|
||||||
return self.coordinator.data.zones[self._zone_id].input == "tuner"
|
return self.source_id == "tuner"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def media_content_id(self):
|
def media_content_id(self):
|
||||||
@ -516,10 +513,15 @@ class MusicCastMediaPlayer(MusicCastDeviceEntity, MediaPlayerEntity):
|
|||||||
self._zone_id, self.reverse_source_mapping.get(source, source)
|
self._zone_id, self.reverse_source_mapping.get(source, source)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def source_id(self):
|
||||||
|
"""ID of the current input source."""
|
||||||
|
return self.coordinator.data.zones[self._zone_id].input
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def source(self):
|
def source(self):
|
||||||
"""Name of the current input source."""
|
"""Name of the current input source."""
|
||||||
return self.source_mapping.get(self.coordinator.data.zones[self._zone_id].input)
|
return self.source_mapping.get(self.source_id)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def source_list(self):
|
def source_list(self):
|
||||||
@ -597,7 +599,7 @@ class MusicCastMediaPlayer(MusicCastDeviceEntity, MediaPlayerEntity):
|
|||||||
return (
|
return (
|
||||||
self.coordinator.data.group_role == "client"
|
self.coordinator.data.group_role == "client"
|
||||||
and self.coordinator.data.group_id != NULL_GROUP
|
and self.coordinator.data.group_id != NULL_GROUP
|
||||||
and self.source == ATTR_MC_LINK
|
and self.source_id == ATTR_MC_LINK
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -606,7 +608,7 @@ class MusicCastMediaPlayer(MusicCastDeviceEntity, MediaPlayerEntity):
|
|||||||
|
|
||||||
If the media player is not part of a group, False is returned.
|
If the media player is not part of a group, False is returned.
|
||||||
"""
|
"""
|
||||||
return self.is_network_client or self.source == ATTR_MAIN_SYNC
|
return self.is_network_client or self.source_id == ATTR_MAIN_SYNC
|
||||||
|
|
||||||
def get_all_mc_entities(self) -> list[MusicCastMediaPlayer]:
|
def get_all_mc_entities(self) -> list[MusicCastMediaPlayer]:
|
||||||
"""Return all media player entities of the musiccast system."""
|
"""Return all media player entities of the musiccast system."""
|
||||||
@ -639,11 +641,11 @@ class MusicCastMediaPlayer(MusicCastDeviceEntity, MediaPlayerEntity):
|
|||||||
and self.coordinator.data.group_id
|
and self.coordinator.data.group_id
|
||||||
== group_server.coordinator.data.group_id
|
== group_server.coordinator.data.group_id
|
||||||
and self.ip_address != group_server.ip_address
|
and self.ip_address != group_server.ip_address
|
||||||
and self.source == ATTR_MC_LINK
|
and self.source_id == ATTR_MC_LINK
|
||||||
)
|
)
|
||||||
or (
|
or (
|
||||||
self.ip_address == group_server.ip_address
|
self.ip_address == group_server.ip_address
|
||||||
and self.source == ATTR_MAIN_SYNC
|
and self.source_id == ATTR_MAIN_SYNC
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -859,8 +861,12 @@ class MusicCastMediaPlayer(MusicCastDeviceEntity, MediaPlayerEntity):
|
|||||||
"""
|
"""
|
||||||
_LOGGER.debug("%s client leave called", self.entity_id)
|
_LOGGER.debug("%s client leave called", self.entity_id)
|
||||||
if not force and (
|
if not force and (
|
||||||
self.source == ATTR_MAIN_SYNC
|
self.source_id == ATTR_MAIN_SYNC
|
||||||
or [entity for entity in self.other_zones if entity.source == ATTR_MC_LINK]
|
or [
|
||||||
|
entity
|
||||||
|
for entity in self.other_zones
|
||||||
|
if entity.source_id == ATTR_MC_LINK
|
||||||
|
]
|
||||||
):
|
):
|
||||||
await self.coordinator.musiccast.zone_unjoin(self._zone_id)
|
await self.coordinator.musiccast.zone_unjoin(self._zone_id)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user