Dear all,
since quite a long time I am working on a lovelace setup to control music on my alexa multiroom setup.
currently it looks like this:
This does work quite well. However it consists of a lot of conditional cards and in total it sums up to more than 17 lovelace cards in order to cover all possible combinations of source (radio & spotify) and Alexa Speaker devices and groups (7 in total).
For each combination I copied & pasted a new card with just the choosen entity being changed in the code. Adding additional speakers or sources pumps up the setting exponentially and the entire code is not really efficent.
The only difference between all cards is the media player entity. So I am basically looking for a way to set up a variable in the lovelace cards where the media player entity is defined. This way I only need one card with this variable which just could be a helper.
e.g. instead of:
entity: media_player.echo_arbeitszimmer
something like this:
entity: {{ states("media_player_entity_helper") }}
I tried using a template card but wasn’t really successful due to lack of knowledge with template cards. Is there an easier way to do it maybe?
Best Pete
and here’s an example of one conditional card:
- type: conditional
conditions:
- entity: sensor.media_player_status_helper
state: Radio & Echo Arbeitszimmer
card:
type: vertical-stack
cards:
- type: custom:mini-media-player
entity: media_player.echo_arbeitszimmer
icon: mdi:amazon-alexa
artwork: none
source: full
hide:
power_state: false
source: true
icon: true
shuffle: true
runtime: false
shortcuts:
columns: 3
buttons:
- name: Radio Bonn
type: custom
id: spiele Radio Bonn Rhein/Sieg von tunein
- name: 1LIVE
type: custom
id: spiele Radio Einslive von tunein
- name: Radio Sunshine
type: custom
id: spiele Radio Sunshine von tunein
- name: 1LIVE diggi
type: custom
id: spiele 1LIVE diggi von tunein
- name: JAM FM
type: custom
id: spiele JAM FM von tunein
- name: BIG FM
type: custom
id: spiele BIG FM von tunein
- name: Pure Ibiza
type: custom
id: spiele pure Ibiza Radio von tunein
- name: Milano Lounge
type: custom
id: spiele Milano Lounge von tunein
- name: Café del Mar
type: custom
id: spiele Café del Mar Radio (official) von tunein
- name: Chill House
type: AMAZON_MUSIC
id: Chill House
- name: Sommerhits
type: AMAZON_MUSIC
id: Sommerhits 2022
- name: Dance Hits
type: AMAZON_MUSIC
id: Dance Hits
name: Echo Arbeitszimmer
volume_step: '5'
min_volume: '5'
- type: custom:mini-media-player
entity: media_player.echo_arbeitszimmer
icon: mdi:amazon-alexa
artwork: full-cover-fit
hide:
power_state: true
source: true
name: true
icon: true
runtime: true
controls: true
power: true
mute: true
info: true
progress: true
volume: true