mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Linkplay - when grouped, the first media player returned is the coordinator (#146295)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
parent
84959a0077
commit
283d0d16c0
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from linkplay.bridge import LinkPlayBridge
|
from linkplay.bridge import LinkPlayBridge
|
||||||
from linkplay.consts import EqualizerMode, LoopMode, PlayingMode, PlayingStatus
|
from linkplay.consts import EqualizerMode, LoopMode, PlayingMode, PlayingStatus
|
||||||
@ -315,14 +315,19 @@ class LinkPlayMediaPlayerEntity(LinkPlayBaseEntity, MediaPlayerEntity):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
shared_data = self.hass.data[DOMAIN][SHARED_DATA]
|
shared_data = self.hass.data[DOMAIN][SHARED_DATA]
|
||||||
|
leader_id: str | None = None
|
||||||
|
followers = []
|
||||||
|
|
||||||
return [
|
# find leader and followers
|
||||||
entity_id
|
for ent_id, uuid in shared_data.entity_to_bridge.items():
|
||||||
for entity_id, bridge in shared_data.entity_to_bridge.items()
|
if uuid == multiroom.leader.device.uuid:
|
||||||
if bridge
|
leader_id = ent_id
|
||||||
in [multiroom.leader.device.uuid]
|
elif uuid in {f.device.uuid for f in multiroom.followers}:
|
||||||
+ [follower.device.uuid for follower in multiroom.followers]
|
followers.append(ent_id)
|
||||||
]
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
assert leader_id is not None
|
||||||
|
return [leader_id, *followers]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def media_image_url(self) -> str | None:
|
def media_image_url(self) -> str | None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user