Lovelace: Mini Media Player

Here you go:

      type: custom:mini-media-player
      entity: media_player.office
      name: Office
      artwork: material
      source: full
      shortcuts:
        buttons:
          - icon: mdi:star
            id: script.startspotifyshuffled_office
            name: Starred
            type: script
          - icon: mdi:numeric-6-box-multiple-outline
            id: DR P6 BEAT
            name: P6 Beat
            type: source
        columns: 2

The first one is a script that starts a playlist shuffled, that looks like this:

startspotifyshuffled_office:
  alias: StartSpotifyShuffled_Office
  sequence:
  - service: media_player.play_media
    target:
      entity_id: media_player.office
    data:
      media_content_id: spotify://b4a955bbf7cc109a6fee955/spotify:playlist:5tlcvrCUclk
      media_content_type: spotify://playlist
    metadata:
      title: Starred
      thumbnail: https://i.scdn.co/image/ab67706c0000bebb24fc45bf8
      media_class: playlist
      children_media_class: track
      navigateIds:
      - {}
      - media_content_type: spotify://library
        media_content_id: spotify://b4a955bbf7cc109a6fee955d5
      - media_content_type: spotify://current_user_playlists
        media_content_id: spotify://b4a955bbf7cc109a6fee955d55/current_user_playlists
      - media_content_type: spotify://playlist
        media_content_id: spotify://b4a955bbf7cc109a6fee955d55cc7a64/spotify:playlist:5tlcvrCUclka8
  - service: media_player.shuffle_set
    data:
      shuffle: true
    target:
      entity_id: media_player.office
  - service: media_player.media_next_track
    data: {}
    target:
      entity_id: media_player.office
  mode: single
  icon: mdi:spotify

The other is a Radio station.

2 Likes

Thanks @bjorn.sivertsen, thats really helpful!

Have been able to use this to create buttons for my Sonos Favourite stations. I use Amazon Music rather than Spotify, but will look and see what I can do about making that work for shuffling playlists too.

For other people, here is the code I used for my Sonos Favourites:

shortcuts:
  columns: 3
  buttons:
    - type: source
      icon: <icon of choice - Optional>
      id: <Favourite name - as displayed within the Sonos App>
      name: <Name to display on the button>

somehow it does not work for me.
I get following error

jinja2.exceptions.UndefinedError: 'state_attr' is undefined

Is there a way to change the color of the attribute shortcut buttons? But I donā€™t want them all the same color. If I have six buttons on the media card can I change only one button to a different color?

What is an attribute shortcut button?

These 6 buttons, maybe Iā€™m saying it wrong

OK, those are shortcuts, you can use an image, which of course can be any colour. All the shortcut options are here. GitHub - kalkih/mini-media-player: Minimalistic media card for Home Assistant Lovelace UI

Is there a way to target Just one button? This works great to change them all, but what if I had 3 buttons and wanted them three different colors

THANK YOU for putting a volume control on there. There are some really great media players out there and for some reason they lack a volume control. This is the BEST!!

Is it possible to display whatā€™s playing on the radio, just the text?

Unless you have a Media player - Home Assistant for that radio, the answer is no.

As the cardā€™s documentation says:

An entity_id from an entity within the media_player domain.

I get the error described below after installing the Mini Media player and adding the following card;

type: custom:mini-media-player
entity: media_player.woonkamer
hide:
  power: true
  icon: true
  source: true
speaker_group:
  platform: sonos
  show_group_count: true
  entities:
    - entity: media_player.woonkamer
      name: Sonos Living Room
    - entity: media_player.keuken
      name: Sonos Kitchen
group: true
volume_stateless: true

After I try to group of ungroup one media player I got this error;
Failed to call service media_player/join. required key not provided @ data[ā€˜group_membersā€™]

Any idea what Iā€™m missing/ doing wrong?

Complete newb here, trying to figure this outā€¦ first custom card.

One of the main reasons I wanted HASS was to control my speakers and Spotify. After a lot of struggling I finally got mini media player installed, but now Iā€™m struggling even harder trying to create the card I want.

I have two Sonos speakers (there are actually five, but four of them are grouped together in Living Room): media_player.living_room and media_player.move

Iā€™m trying to create a card that allows me to do the following:

  1. Group/ungroup the speakers
  2. Change volume of each speaker independently
  3. Change volume of the group
  4. Has a button that allows to ā€œbrowse mediaā€ OR- IF POSSIBLE- Has a button that takes me directly to Spotify media
  5. Potentially more buttons on bottom to start a specific Spotify playlist

Can anyone help me out? Iā€™ve been reading and tinkering but I just canā€™t figure this out. Iā€™ve gotten maybe one of each of the above accomplished on separate players, just by copying/pasting from the Wiki, but beyond that Iā€™m hitting a wall.

Is it possible to show the progress of the media but disable the ability to jump around? Itā€™s really easy to accidentally change the progress of our movie when Iā€™m scrolling through my dashboard on my phone.

I am using this card with a few alexa speakers. However, every time I try to skip back or skip forward on a song, i get the error

ā€œFailed to call service media_player/media_seek. Entity media_player.office_speaker does not support this service.ā€

I have only recently switched over from Google Assistant to Alexa and never had this issue. Is this a limitation of the Alexa speakers themselves or the Alexa Media Player integration?

is there any workaround to get this working?

Thanks

Are you using this? GitHub - custom-components/alexa_media_player: This is a custom component to allow control of Amazon Alexa devices in Home Assistant using the unofficial Alexa API.

If so, it doesnā€™t appear to support seek.

Thanks for the response. Sorry I should have said what integration I am using and yes itā€™s that one.

Oh well nevermind, I will just hide the progress bar in that case

Thanks again

Iā€™m not too sure if this is possible. All buttons sit in the same div container and have the same class assigned. so you would need an individual class for eacht color and apply it to the button. The latter is the tricky partā€¦

I actually did figure this outā€¦The guy that runs Card Mod page referred me to his link on the first post of the page, that basically gives you the breakdown of everythingyou could possibly need. lol Thanks for the reply though.

Are you going to share?