Lovelace: Mini Media Player

Is it possible to use the following example below as a button on my Sonos media card? It’s working with radio stations added to Sonos favorites but not Spotify playlists (even when added to favorites).
buttons:
# Start predefined playlist
- icon: mdi:cat
type: playlist
id: spotify:user:spotify:playlist:37i9dQZF1DZ06evO2O09Hg

I searched the thread but could not find - does anyone know offhand what the platform for the google home speakers is?

It seems to work without the correct configuration, but I’m unable to manually select or deselect speakers for group membership as the xxx/join service is not found.

It’s not a huge issue, it works when I have them all in the yaml, I just can’t do it on the fly.

There is a list of platforms that can use speaker grouping.

Supported platforms

  • sonos
  • soundtouch
  • squeezebox2
  • bluesound2
  • snapcast2
  • yamaha_musiccast1

I can’t see google home there.

Ok, I read that too, but wasn’t sure since I was able to get the speakers grouped AND working, just not selectable.

I appreciate the reply, seems that everything is working EXACTLY as designed.

I just have a bunch of different speaker groups set up in Google and then select the group within HA (from an input_select) depending on where I want music

I just found new love for this card, thank you Karl!

Using a mix of different hide options, grouping, conditionals and custom:stack-in-card I have a super tidy card that only shows which speakers are in use and gives me volume control in each area. I had this for a while but it wasn’t as compact until now. Loving it :slight_smile:

image

8 Likes

That’s pretty neat, mind sharing the yaml?

1 Like

Sure.

cards:
  - card:
      entity: media_player.lounge_tv
      group: true
      hide:
        icon_state: false
        power_state: false
      icon: 'mdi:television'
      type: 'custom:mini-media-player'
    conditions:
      - entity: media_player.lounge_tv
        state_not: 'off'
    type: conditional
  - card:
      entity: media_player.onkyo_amp
      group: true
      hide:
        controls: true
        icon_state: false
        power_state: false
        progress: true
      icon: 'mdi:amplifier'
      type: 'custom:mini-media-player'
      volume_stateless: true
    conditions:
      - entity: media_player.onkyo_amp
        state_not: 'off'
    type: conditional
  - card:
      entity: media_player.everywhere
      group: true
      hide:
        icon_state: false
        power_state: false
      icon: 'mdi:speaker-wireless'
      type: 'custom:mini-media-player'
    conditions:
      - entity: media_player.everywhere
        state_not: 'off'
    type: conditional
  - card:
      entity: media_player.all_except_office
      group: true
      hide:
        icon_state: false
        power_state: false
      icon: 'mdi:speaker-wireless'
      type: 'custom:mini-media-player'
    conditions:
      - entity: media_player.all_except_office
        state_not: 'off'
    type: conditional
  - card:
      entity: media_player.house
      group: true
      hide:
        icon_state: false
        power_state: false
      icon: 'mdi:speaker-wireless'
      type: 'custom:mini-media-player'
    conditions:
      - entity: media_player.house
        state_not: 'off'
    type: conditional
  - card:
      entity: media_player.house_except_office
      group: true
      hide:
        icon_state: false
        power_state: false
      icon: 'mdi:speaker-wireless'
      type: 'custom:mini-media-player'
    conditions:
      - entity: media_player.house_except_office
        state_not: 'off'
    type: conditional
  - card:
      entity: media_player.lounge_and_office
      group: true
      hide:
        controls: true
        icon_state: false
        power_state: false
      icon: 'mdi:speaker-wireless'
      type: 'custom:mini-media-player'
    conditions:
      - entity: media_player.lounge_and_office
        state_not: 'off'
    type: conditional
  - card:
      entity: media_player.googlehome3019
      group: true
      hide:
        controls: true
        icon_state: false
        power_state: false
        progress: true
      icon: 'mdi:speaker-wireless'
      type: 'custom:mini-media-player'
    conditions:
      - entity: media_player.googlehome3019
        state_not: 'off'
    type: conditional
  - card:
      entity: media_player.lounge_speakers
      group: true
      hide:
        controls: true
        icon_state: false
        power_state: false
        progress: true
      icon: 'mdi:speaker-wireless'
      type: 'custom:mini-media-player'
    conditions:
      - entity: media_player.lounge_speakers
        state_not: 'off'
    type: conditional
  - card:
      entity: media_player.bedroom
      group: true
      hide:
        controls: true
        icon_state: false
        power_state: false
        progress: true
      icon: 'mdi:speaker-wireless'
      type: 'custom:mini-media-player'
    conditions:
      - entity: media_player.bedroom
        state_not: 'off'
    type: conditional
  - card:
      entity: media_player.googlehome0147
      group: true
      hide:
        controls: true
        icon_state: false
        power_state: false
        progress: true
      icon: 'mdi:speaker-wireless'
      type: 'custom:mini-media-player'
    conditions:
      - entity: media_player.googlehome0147
        state_not: 'off'
    type: conditional
  - card:
      entity: media_player.googlehome2136
      group: true
      hide:
        controls: true
        icon_state: false
        power_state: false
        progress: true
      icon: 'mdi:speaker-wireless'
      type: 'custom:mini-media-player'
    conditions:
      - entity: media_player.googlehome2136
        state_not: 'off'
    type: conditional
  - card:
      entity: media_player.chromecastaudio8002
      group: true
      hide:
        controls: true
        icon_state: false
        power_state: false
        progress: true
      icon: 'mdi:speaker-wireless'
      type: 'custom:mini-media-player'
    conditions:
      - entity: media_player.chromecastaudio8002
        state_not: 'off'
    type: conditional
  - card:
      entity: media_player.alfresco_sony
      group: true
      hide:
        icon_state: false
        power_state: false
      icon: 'mdi:speaker-wireless'
      type: 'custom:mini-media-player'
      volume_stateless: true
    conditions:
      - entity: media_player.alfresco_sony
        state_not: 'off'
    type: conditional
mode: vertical
type: 'custom:stack-in-card'
3 Likes

Thank you!

Below is example from the github page, where to find the id for the Spotify playlist?
Does it have to be a playlist? Can it be just a specific song(and how to find the id)?

- 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
1 Like

hi is it possible for a button triggering a service (input boolean toggle) to show the state of the boolean on the button ?

From the Spotify desktop app: Right click a track, playlist, album e.t.c. go to Share and press Copy Spotify URI.

Not sure if it matters but for an album set type to album, and for a single track set it to music or track I think.

1 Like

No, but check out button-card.

thanks got it working in a button card but was wondering if i could do it all in one card

Thanks. I got the uri which is below format
spotify:playlist:xxxxxx
I also tried add spotify:user: to the front, either one is working for me.

Does this require spotify premium? which I don’t have.

Recently I got an email from spotify saying free account can also link to Alexa.

I believe it requires premium yes, see the note here: https://www.home-assistant.io/integrations/spotify/

This is an amazing piece of code! Family has been using it on the regular with our Sonos system.

I tried to get fancy and used auto-entity card to show playing zones.

card:
  show_header_toggle: false
  title: Music Playing
  type: entities
filter:
  exclude:
    - state: paused
    - state: idle
    - state: unavailable
  include:
    - domain: media_player
show_empty: false
type: 'custom:auto-entities'

but I added one player, my office, in the exclude section

- entity_id: media_player.myoffice

Though it worked perfectly in not showing my playing zone, every 2-5 minutes the zone would pause all on it’s own. The log simply showed that the zone was paused, but no user associated with the pause, nor was there any automations or events or scenes that even referenced this player.

I went and deleted the exclude and I haven’t had a pause in 45 minutes.

This is probably not a mini media player issue, more likely an auto-entity card problem, but figured I’d post this in case someone else has the same issue.

G

1 Like

thanks. so for this to work, need premium, and also that spotify integration, right?

Oh, I thought you were using the Spotify integration, what media player are you trying to do this on?
The Spotify integration is the only media player integration that I’m aware of which supports Spotify URIs through the play_media service.

I am trying to play spotify songs on my echo dot which is integrated using Echo Devices (Alexa) as Media Player - Testers Needed.