Lovelace: Mini Media Player

Do you mind sending me screenshot of your setup? I guess I could remove the max-width limit of the slider in the “non-compact” card config. I’ve actually never tried the card with panel set to true.

Idk if this is of interest to you but I found myself in a similar situation, where I wanted to make fine volume adjustments easier. I ended up using seperate card just for the volume control, where I hid everything except the volume slider.

30

- entity: media_player.avr_tv
  type: custom:mini-media-player
  max_volume: 72
  hide:
    controls: true
    name: true
    icon: true
    info: true
    power: true
    source: true
    mute: true

That’s a great solution, just making a ‘volume’ card will work for me, thanks!!!

1 Like

hello, fisrt of all just wanna say im completely in love with this mode, works as a charm!!! Thank you so much.

The only thing seems not working for me is the progress bar for some reason…
Other thing i created some buttons for my playlists which are working perfect but would be awsome to see which playlist is playing … if any. Like changing the color of the button, any idea?

1 Like

Hi, in order for the card to calculate and display the progress your media player component has to expose the following three attributes media_duration, media_position and media_position_updated_at. You can check if it does by navigating to /dev-state.

Don’t think it’s possible to implement, at least not with the Spotify component, since there is no way of knowing which playlist is currently playing.

none of those are enabled, don’t know how to enable them

Okay, you can’t manually enable those unfortunately, the specific media player component has to have support for those attributes and if it does, they will be exposed by default.

The cast component do expose them for example.

Hi all,
I have below in my ui-lovelace.yaml file, but the sonos grouping doesn’t show up:

resources:
  - url: /local/mini-media-player-bundle.js?v=1.0.3
    type: module

      - type: custom:mini-media-player
        entity: media_player.sonos_tv_room
        hide:
          power: true
          icon: true
          source: true
        speaker_group:
          platform: sonos
          show_group_count: true
          entities:
            - entity_id: media_player.sonos_tv_room
              name: Sonos TV room
            - entity_id: media_player.sonos_alfresco
              name: Sonos Alfresco
    icon: 'mdi:music'
    path: music_tab
    title: music

it shows up as below:

any help would be appreciated.
thanks

Sorry about that, the documentation showed unreleased stuff.

I changed back the repo to show the master branch now which is the latest release.

The speaker_group option is called sonos until next release, so simply changing speaker_group to sonos should solve your issue.

In the next release the sonos option will be renamed to speaker_group and take an additional platform option, in order to support speaker grouping for more platforms than Sonos in the future.

Old configurations still using the sonos option will continue to work, at least for a few more updates, to give people time to switch over to the new configuration option.

1 Like

Thanks work perfectly. regarding the spotify, it gives me a fail due to restricted device, any idea how I can solve that?

That’s backend related, never seen that error personally, did you setup the Spotify component correctly?

1 Like

not sure, I am new :stuck_out_tongue: will try to configure it again.
Thanks a lot again and thanks for sharing, great custom card :slight_smile:

1 Like

I managed to find the issue. Spotify is not supporting Sonos. I changed the source to my TV and it works.

1 Like

Playing with the buttons to create a nice little push button radio, I am successful doing the following in lovelace:

...
                shortcuts:
                  columns: 3
                  buttons:
                    - name: ABC (Jazz)
                      type: script
                      id: script.play_jazz
                    - name: Cafe I (Jazz)
                      type: script
                      id: script.play_french_jazz
                    - name: 680 (Cnty)
                      type: script
                      id: script.play_country_680
...

and calling the script, i.e. script.play_french_jazz:

play_french_jazz:
  alias: Play French Jazz
  sequence:
  - data:
      entity_id: media_player.406_living_room_echo_dot
      media_content_id: 'CAFÉ I Soulside Radio Paris'
      media_content_type: 'TUNEIN'
    service: media_player.play_media

works. But for the life of me, I can’t figure out how to just embed this into the shortcut (i.e. type: source and id: TUNEIN:‘CAFÉ I Soulside Radio Paris’). Is my syntax wrong, is this not supported, am I asking the impossible?

The type parameter should be the same as media_content_type, so your script would look like this if we converted it to a shortcut button.

- icon: mdi:cat
  type: TUNEIN
  id: 'CAFÉ I Soulside Radio Paris'

Let me know if the example works.

1 Like

YEAH!!! (of course it works) Thank you!

You saved me from having to write a dozen scripts for EACH of my echos… which proliferate in this household like bunnies.

1 Like

So that I can play anything anywhere I created three input selects and two play scripts
Now I just select what I want and execute the require script

input_select:
  choose_radio:
    name: Choose Radio Station
    icon: mdi:radio
    options:
      - Talksport
      - Smooth West Midlands
      - Heart Birmingham
      - Magic
    initial: Talksport
  choose_music:
    name: Choose Music
    icon: mdi:music
    options:
      - Album Doo Wops and Hooligans
      - Album Unorthodox Jukebox
      - Cher
      - Playlist Easy
      - Playlist Eagles
  choose_player:
    name: Choose Echo Device
    icon: mdi:amazon
    options:
      - study
      - lounge
      - bedroom

scripts

playmusic:
  sequence:
  - service: media_player.play_media
    data_template:
      entity_id: '{{ "media_player." + states("input_select.choose_player") }}'
      media_content_id: '{{ states("input_select.choose_music") }}'
      media_content_type: 'AMAZON_MUSIC'
#
playradio:
  sequence:
  - service: media_player.play_media
    data_template:
      entity_id: '{{ "media_player." + states("input_select.choose_player") }}'
      media_content_id: '{{ states("input_select.choose_radio") }}'
      media_content_type: 'TUNEIN'
1 Like

ha thanks for that, @traverst
would you know of a way to use spotify in that same manner?
media_content_type: ‘Spotify’ and preferably an album to choose?

Isnt media_content_type restricted to: music , tvshow , video , episode , channel or playlist, see https://www.home-assistant.io/components/media_player#service-media_playermedia_play ? Using ‘audio/mp4’ myself, and that’s not listed either… nb, for mp3 streams…All a bit confusing this is.

Cant seem to get it to work (on my google homes, or chrome casts) nor can I find real solutions in this community. Other than using the media_player spotify, which is not what I am looking for I think.

I dont have google home or spotify so unable to test anything, sorry

no worries hope others will read too;-)
where did you get the reference for the content_types? as described in my post above, we use non listed options. might be more I don’t know of, and hopefully spotify would among those?

My experience with this has shown me; use upper-case (ie TUNEIN for TuneIn)… that works for mine. I’ve also succeeded with AMAZON_MUSIC. I’ve seen comments from others that SPOTIFY works. I have NOT succeeded with IHeartRadio yet.

Oh yeah, one other little observation. If you use multiple Echo’s, tuning each to a different source at the same time works fine, except for Amazon… it only allows one Amazon source selection at a time.