Lovelace: Mini Media Player

@ctowers
My main objective was to automate how the buttons or list was created from the sonos favorites sensor using the for loop. Using scripts or service calls is more of a personal preference and use case.

Is it possible to start a Sonos playlist with a button?
I don’t use Spotify, but have plex integration in sonos app.

If it is possible how can I set that up?
it would be nice if i could play an album like this

minimediaplayer
When change volume or something see the background image bright for a sec but after go to fades. I use config-template-card to use internet radio background image. If I use without artwork it is ok. But I need artwork when I play spotify.
“full-cover” everything is ok but with “cover” what I want to use the image is fade.
This is my settings:

type: custom:config-template-card
variables:
  - states['media_player.denon_avr_x1000'].attributes.media_artist
entities:
  - media_player.denon_avr_x1000
card:
  type: custom:mini-media-player
  entity: media_player.denon_avr_x1000
  artwork: cover
  hide:
    icon_state: false
    power_state: false
    runtime: false
    sound_mode: false
    source: false
    volume: false
    progress: false
  icon: mdi:music-box
  info: scroll
  max_volume: '80'
  name: Denon
  style: |
    ha-icon {
      color:
        {% if states(config.entity) == 'playing' %}
          var(--accent-color)
        {% else %}
          var(--iron-icon-fill-color)
        {% endif %}
        ;
    }
    :host {
      --secondary-text-color: red;
      --mini-media-player-media-cover-info-color: red;
    }
    ha-card { --ha-card-background: rgba(0, 0, 0, 0); 
              --ha-card-box-shadow: none; }
  background: |-
    "${ if (vars[0] === 'Retro Radio') { '/local/retro2.png' }
        else if (vars[0] === 'Radio1 Debrecen') { '/local/radio1.png' }
        else if (vars[0] === 'BBC Radio 1') { '/local/bbcradio1.jpg' }
        else { '/local/default.png' }
      }"

I used your settings, just with different radio stations and different images and I don’t have the effect you got.

But I don’t really understand why you are doing it this way. I get the radio stations logos or the artwork of the tracks of my Spotify playlists without declaring them in the code.

Because what I listen internet radios not have image! So manually must set it up with config-template-card.
With spotify not have problem.

oh, I wouldn’t have said it without testing it:

BUT! I play radio stations via tunein so there might be advertisers.

I use with denon music player and there can use only radiobrowser. And there no image.

Ah okay. Wasn’t aware it is a limitation of the player.
So the problem you’re facing might be caused by the player as well, since I don’t have it with my players.

Love this card, 2 questions:

  1. is there a way to use this with UI-Lovelace-Minimalist? The browse media button doesn’t seem to work; probably because opening another pop-up. Alternatively can I add a browse button directly to the card?
  2. I am using the tts volume setting for Sonos. Any ideas is something similar is coming for Google Nest?

Thanks!

The player has nothing to do with it. That image simply doesn’t look the way it should.

As far as I know, Radio Browser does not provide an entity_picture

That’s why I would use manual background picture.

background: |-
    "${ if (vars[0] === 'Retro Radio') { '/local/retro2.png' }
        else if (vars[0] === 'Radio1 Debrecen') { '/local/radio1.png' }
        else if (vars[0] === 'BBC Radio 1') { '/local/bbcradio1.jpg' }
        else { '/local/default.png' }
      }"

The question is not why the player and the radibrowser do not give a picture or give. Please read back what is my problem.

Hi Nick, I get pictures when playing radio stations via Tunein, but I’m not sure about what is meant with “Radio Browser” - has this to do with the Denon player?

Well, as said, when I use your code (but with different players) and with static background images as you do, I don’t have the problem you have.
ezgif.com-gif-maker

Edit: I am sorry, the code for the background image seems not to work here.
I should get the default.jpg when playing another station but I always automatically get the logo of the radio station I play.

Radio Browser - Home Assistant is what @spider7611 is using.

Thanks.
My bad, I never would have thought he uses the integration and missed when he mentioned it.

If you use a image in the shortcut buttons can you resize the the image to fill the whole button?

I have an odd issue, and I am not sure if it’s the entity filter card or mini media player card that is at fault.

But the content of the media card doesn’t fill out the margin of the card when it is nested within an entity-filter card. If I use any other nested card, like the conditional card and mini media player, there are no issues, as you can see in the top of the picture.

image

type: vertical-stack
title: Media
cards:
  - type: conditional
    conditions:
      - entity: media_player.living_room_tv
        state: playing
    card:
      type: custom:mini-media-player
      group: true
      artwork: material
      source: icon
      sound_mode: icon
      entity: media_player.living_room_tv
      info: short
      name: Living Room
  - type: entity-filter
    entities:
      - type: custom:mini-media-player
        entity: media_player.dining_room
        attribute: group_members
        group: true
        artwork: material
        info: short
        hide:
          power: true
          icon: true
        speaker_group:
          platform: sonos
          sync_volume: true
          entities:
            - entity_id: media_player.living_room
              name: Sonos Living Room
            - entity_id: media_player.kitchen
              name: Sonos Kitchen
            - entity_id: media_player.bathroom
              name: Sonos Bathroom
            - entity_id: media_player.bedroom
              name: Sonos Bedroom
        state_filter:
          - attribute: group_members
            operator: regex
            value: ^..media_player.dining_room[^_]

Anyone got an idea?

I “installed” this card yesterday and am impressed. It’s very useful and efficient and with the card-mod I was able to tweak it a little more.

I respond to this post, cause I currently use the tap_action to navigate to a lovelace card, but am wondering if if this is also supported as a shortcut button. It would be my preferred way to go if it’s supported, even though the “card tab” works perfectly (on IOS too).

If it’s possible I am wondering what the syntax would be. If it’s not possible, it’s fine the way it works and I know I don’t have to keep trying :grinning_face_with_smiling_eyes:

Bumping this one up. I find it interesting if this could be done. Struggling with the same issue, so @Marcus_Lundblad how did you manage it?