Lovelace: Mini Media Player

Hi @markcs , the way I did this is do a script to each device where you let the devide id defined and the variable is the tts that you want to send, and after you created a script to every devide you create a last one that controls that picks witch script to run using a helpers list

You will need to create the list with the devices but you can use any name dont have to be the Id or anything could be “Bedroom”, “Living Room” etc.

After that you can just put the list as an entity in the dashboard and a trigger to the script that rules all the scripts as a button.

here examples:

this code send the command to alexa, jsut change it to the tts of google

alias: play music in oficina
sequence:
  - service: media_player.play_media
    data:
      media_content_id: '{{ states(''input_text.play_on_echo'') }}'
      media_content_type: SPOTIFY
    entity_id: media_player.echo_dot_de_oficina
mode: single

This one controls what script to run

alias: play music
sequence:
  - service: script.turn_on
    data:
      entity_id: >-
        {% if is_state("input_select.echos", "Cuarto") %} script.play_my_music
        {% elif is_state("input_select.echos", "Oficina") %}
        script.play_music_in_oficina {% endif %}
mode: single

and this one is the card i use, not fancy but works

type: entities
entities:
  - entity: input_text.play_on_echo
    icon: 'mdi:amazon-alexa'
    name: play
  - entity: input_select.echos
  - type: call-service
    name: ' '
    icon: ' '
    action_name: Reproducir ...
    service: script.play_music

Hi all, and thanks for this fantastic Lovelace Card !
I have a question and hope someone can help me…
First of all my stuff is some Alexa speakers around the house some of the grouped ( in alexa ).
What i want to do is to have some buttons in Mini-Media-Player that can starts a script that plays playlist in particolare groups or speakers.
If I create a button that calls a script everything works perfectly but i don’t want to create a script for each playlist and each speaker so I need to pass some variables but i not able to do that…

The following is correctly working :

SCRIPT :
( playlist < any pl > su < speaker > is the italian way to send music on alexa )

avvia_riproduzione_mp:    
  sequence:
  - service: media_player.play_media
    data:                                 
      media_content_id: playlist emile su stanza emile
      media_content_type: APPLE_MUSIC
    target:       
      entity_id: media_player.stanza_emile
  mode: single         
  icon: mdi:speaker                         
  alias: pl emile su emile 

mini-media-player card working :

type: custom:mini-media-player
entity: media_player.stanza_emile
icon: mdi:amazon
tts:
  platform: alexa
  entity_id: media_player.stanza_emile
volume_stateless: false
group: true
toggle_power: true
replace_mute: stop
info: short
source: icon
sound_mode: full
artwork: cover
name: stanza emillino
shortcuts:
  buttons:
    - name: Avvia Playlist
      type: service
      id: script.turn_on
      data:
        entity_id: script.avvia_riproduzione_mp

what I need to do , instead, is
SCRIPT ( that is working correctly if called by an automation ) :

avvia_riproduzione_variabili:
  alias: Avvia Riproduzione (variabili)                                          
  sequence:                                                                      
  - service: media_player.play_media                                               
    data:               
      media_content_id: '{{ lista_musica }} su {{ altoparlanti }}'
      media_content_type: APPLE_MUSIC
    target:         
      entity_id: media_player.echo_studio_di_actis
  mode: single
  icon: mdi:music

called by the lovelace card :

type: custom:mini-media-player
entity: media_player.stanza_emile
icon: mdi:amazon
tts:
  platform: alexa
  entity_id: media_player.stanza_emile
volume_stateless: false
group: true
toggle_power: true
replace_mute: stop
info: short
source: icon
sound_mode: full
artwork: cover
name: stanza emillino
shortcuts:
  buttons:
    - name: Avvia Playlist
      type: service
      id: script.turn_on
      data:
        entity_id: script.avvia_riproduzione_variabili
        lista_musica: 'playlist emile'
        altoparlanti: 'stanza emile'

any help will be appreciated : THANKS !

Hello all,

I solved my problem above: the clue was only to use button type script instead of service !!!
for who needs here is how I solved changing the buttons part :

  buttons:
    - name: Avvia Playlist
      type: script
      id: script.avvia_riproduzione_variabili
      data:
        lista_musica: playlist cucina
        altoparlanti: stanza emile

Any idea why my mdi icons are not showing?

type: custom:mini-media-player
entity: media_player.sony_bravia_tv
volume_stateless: true
volume_step: '2'
max_volume: '40'
shortcuts:
  columns: 3
  buttons:
    - icon: mdi:youtube
      type: source
      id: DRTV
    - icon: mdi:youtube
      type: source
      id: YouTube
    - icon: mdi:netflix
      type: source
      id: Netflix
hide:
  runtime: false
  power_state: false
  icon_state: false
  volume_level: false
scale: '1'

Screen Shot 2021-07-05 at 6.37.45 PM

Caching issue?

Don’t know. I’ve cleared cookies rebooted etc.
it is only the buttons that doesn’t work. I can change the icon on the card title

Aren’t the mdi icons supposed to be enclosed in single quotes? E.g. 'mdi:youtube'

Not necessarily. I have mine without any quotes and it is working (for me).

Is there a way to set the background color for this card when idle?

Check the background setting.

So it seems I have to make a solid color image rather than using a simple color code.

The image works except that the cover art never goes away after the song is done. How do I revert back to the background image?

That most likely has to do with the media player used and not the card. I’ve seen this happen sometimes with my Apple TV media player integration. Check the state of your player to see if there is cover art when you don’t expect it.

Is it possible to do speaker management with forked-daapd or owntone? I don’t see it listed as a platform for speaker group management, but it seems that some have been able to accomplish this

Are there any typical explanations as to why artwork would suddenly stop working in this card? I’m using a few Sonos devices and the artwork is appearing the Sonos app. I even just threw together a new, basic card to see if the artwork would appear and it does not:

- type: custom:mini-media-player
  entity: media_player.sonos_kitchen
  icon: mdi:speaker
  artwork: cover
  hide:
    source: false
    power_state: true
    icon: true

No artwork… the play button works, but it does not change to a pause button while playing and will not pause if clicked again. The volume slider works from Lovelace, but does not reflect volume changes made from within the Sonos app. There’s no progress bar. Strange.

same behaviour happened to me, just after “Sonos system update” (firmware update).
In my case it is not linked to the lovelace: mini media player, as I use the standard Spotify built-in of home assistant. The artwork and name of song do not change anymore.

This is more than enough for me about this proprietary software/hardware sonos. I am at day 85 from my 90-days return policy from the vendor (Ikea), so I am packing this thing and going to Ikea tomorrow.

Ah, good to know, thanks. No returns for me, as all of my equipment is first-gen (still using S1 app).

Test the core media_player card, or better yet: use the dev tool of HA to test out the Sonos media_player. Check if artwork and service-calls work there. All this card does is process the info given to it by HA. So chances are there is no artwork to begin with and volume service calls don’t work anymore. If they don’t work there, there is nothing this card can do about it :wink:

This is only halfway related to Mini Media Player, but does anyone know how to make the cards conditional, depending if they are needed or not?

Currently, if I group multiple Sonos speakers, I basically get the same number of cards that does the same job.

The picture below tries to illustrate the cards I don’t need, in such scenario.

image

Has anybody experienced that the announce feature doesn’t work anymore?


service: notify.alexa_media
data:
  message: test
  data:
    type: announce