kalkih / mini-media-player

Minimalistic media card for Home Assistant Lovelace UI
MIT License
1.48k stars 206 forks source link

Question - Dynamic group_mgmt_entity #728

Open somejavadev opened 1 year ago

somejavadev commented 1 year ago

Hi,

Thanks for this awesome frontend component. I currently have the following configuration:

type: custom:mini-media-player
entity: media_player.spotify
hide:
  source: true
  power: true
  volume_level: true
speaker_group:
  platform: linkplay
  show_group_count: true
  group_mgmt_entity: media_player.kitchen_linkplay
  entities:
    - entity_id: media_player.kitchen_linkplay
      name: Kitchen
    - entity_id: media_player.dining_room_linkplay
      name: Dining Room
    - entity_id: media_player.patio_linkplay
      name: Patio

What I would like to achieve is to dynamically select the group_mgmt_entity based on the Source entity of the spotify player.

The reason I want to do this is to allow flexibility on which group of speakers are playing. With the current configuration I can only listen to the kitchen speaker and the other speakers, I would ideally as an example select the dining room speaker as the source and still have group changing control without having to always play music on the kitchen speaker.

Example: Change source of the spotify player to patio and then group the dining room speaker without having to listen to music in the kitchen.

Is there perhaps a different configuration I would need to apply or a way to dynamically swap out the group_mgmt_entity.

I tried changing the group_mgmt_entity to the spotify player but this does not work most likely because it isn't a linkplay device.

Perhaps I need to approach this differently?

The current idea I have is perhaps add support for templates in the group_mgmt_entity field and then be able to add something in these lines media_player.{{state_attr('media_player.spotify', 'source') | lower }}_linkplay