Lovelace: Mini Media Player

Yep I am getting the hang of it now :slight_smile:

1 Like

I figured it out - something like this. Is there anyway to add square thumb images to the buttons? how would you achieve that?

26

This card is great - thank you

1 Like

Not possible, I would recommend checking out the custom button card for more advanced button use cases.

1 Like

EDIT: Turns out I was trying to add buttons to the custom card type, not the media_player.spotify card.
Will continue to troubleshoot, unless someone has already got yaml for similar…


I seem to be getting myself confused, got the grouping (Google Home / Home Minis) setup ok, but looking to add buttons for Spotify playlists to play on the group.

Using the example doesn’t seem to work - although I’ve also only just set up the Spotify component so that may be where the issue lies…

type: entities
entities:
  - type: 'custom:mini-media-player'
    entity: media_player.home_group
    group: true
    source: full
    info: scroll
    hide:
      progress: true
      volume: true
      power: true
    shortcuts:
      columns: 2
      buttons:
        - icon: 'mdi:cat'
          type: playlist
          id: 'spotify:user:spotify:playlist:37i9dQZF1DWXJGulibxRbg'
        - icon: 'mdi:dog'
          type: playlist
          id: 'spotify:user:spotify:playlist:37i9dQZF1DZ06evO2O09Hg'
  - type: 'custom:mini-media-player'
    entity: media_player.kitchen_speaker
    group: true
    hide:
      controls: true
      progress: true
      info: true
      icon: true
  - type: 'custom:mini-media-player'
    entity: media_player.study_speaker
    group: true
    hide:
      controls: true
      progress: true
      info: true
      icon: true
  - type: 'custom:mini-media-player'
    entity: media_player.wine_speaker
    group: true
    hide:
      controls: true
      progress: true
      info: true
      icon: true

Capture
(image shows it already playing from asking GH to play music)

1 Like

Hi @kalkih this card is great thanks for your efforts. Do you have plans to implement the ability to directly input a URL to play? I have created buttons for internet radio etc and have successfully setup a script as a button. The script calls media_extrator.play_media which allows me to play youtube videos to my audio only devices / chromecasts.

I see you’ve implemented to ability to pass variables to the scripts which is great, but in this case I want to input the URL directly from the card.

Would this be something you’d be interested in implementing?

I would imagine it would be an optional input field which just passes the entered URL to the media_extractor.play_media service. Here is the script which I’ve been using.

test:
alias: Test2
sequence:

Spotify uri´s are not supported by the cast component (cast devices) unfortunately, you could however utlilize this component Spotcast - custom component to start playback on an idle chromecast device to start spotify playback on desired cast device/group.

Since the shortcuts in this card doesn’t support service calls (yet), You’d have to create a simple script with variables for uri & device which calls the spotcast service, then use this script in the mini-media-player shortcut buttons with the uri & device fed through the shortcut data option.

Thanks!
Don’t think this is something i’ll ever add to the card unfortunately, mostly because it can be achieved fairly easy already thanks to the flexibility of lovelace, an input_text, a button and a script and you’re ready. You could even utilize a mini-media-player shortcut button to trigger the script.

Yeah ok no worries. I have a button triggering the script but the URL is statically configured on the back end so was just checking if this was something ‘coming soon’ before looking for alternatives.

Thanks for the quick response!

@kalkih is it possible to implement speaker grouping for squeezebox?

1 Like

I’m not familiar with squeezebox so can’t say, but yeah, it’s not available in the squeezebox component.

So i’d need to replicate the sonos service sonos.join and sonos.unjoin?

Basically, yes.
It has to be supported in the backend in order for me to add support for it in the card,

But I’m not even sure if squeezebox has official multiroom support to begin with? If it doesn’t, it could be quite tricky/impossible to implement.

Oh yes it does! In the docs it is referred to as synchronisation. Basically any players synched together will play the same media, and you can control from any player, or over the API or web page. Works very well, and did long before sonos was even a thing.

1 Like

I’ve tried multiple times to get the preconfigured buttons containing playlist links to work but they dont do anything when i press them. HA-log is silent. Everything else seem to work as it should.

I’ve tried the example code you’ve provided in your github aswell (visible below) but no luck there either.
Do ppl have this working at the moment? And does the below code work for you?

  • entity: media_player.spotify
    type: custom:mini-media-player
    artwork: cover
    source: icon
    hide:
    volume: true
    shortcuts:
    columns: 4 # Max buttons per row
    buttons:
    # Start predefined playlist
    - icon: mdi:cat
    type: playlist
    id: spotify:user:spotify:playlist:37i9dQZF1DZ06evO2O09Hg

Please post your code properly. How to help us help you - or How to ask a good question

@kalkih thanks mate, I’ll continue tinkering!

1 Like

Yes, it works, note that the id format has to be supported by the platform, a spotify uri for example will most likely not work on other platforms than spotify.

When I try to use the grouped card with multiple Sonos players using the code provided, I get the following error:

Your config is not supported by the UI editor:
**Expected a value of type `{entity,name,icon} | entity-id` for `entities.0.type` but received `"custom:mini-media-player"`.**
Falling back to YAML editor.

Please post the config.
You could also try using the raw UI editor.

That is the error in the raw config editor. It doesn’t work as written below because of the leading dash.

- type: entities
  entities:
    - type: custom:mini-media-player
      entity: media_player.multiroom_player
      group: true
      source: icon
      info: short
      hide:
        volume: true
        power: true
    - type: custom:mini-media-player
      entity: media_player.kitchen_speakers
      group: true
      hide:
        controls: true
    - type: custom:mini-media-player
      entity: media_player.bathroom_speakers
      group: true
      hide:
        controls: true
    - type: custom:mini-media-player
      entity: media_player.bedroom_speakers
      group: true
      hide:
        controls: true
    - type: custom:mini-media-player
      entity: media_player.patio_speakers
      group: true
      hide:
        controls: true

It’s actually from the GUI editor when it can’t auto-configure a card it switches to yaml mode but it’s not the same thing as the raw editor.