Lovelace: Mini Media Player

so you would think something like

  - service: media_player.play_media
    data_template:
      entity_id: '{{ "media_player." + states("input_select.choose_player") }}'
      media_content_id: spotify:album:redctedcodefromspotifyHI
      media_content_type: 'SPOTIFY'

This is getting pretty off topic but here’s my solution

@Mariusthvdb I don’t think the cast component supports spotify and such as media_content_type, the custom alexa component supports a bunch of stuff though.

I went with assistant relay instead together with a few HA scripts, takes a few minutes to set up but works great for starting Spotify playback on desired cast device/group. You can also use Assistant Relay to do a bunch of other stuff

sort for that, will take it elsewhere
and thanks for your reference of assistant relay, will check that out.

What i might ask you is how your card uses the media_content_type, and how we would know what other options to use for that field than the ones described in the docs referenced, or even in the source code, where none of the here mentioned types exist (spotify, tune in, amazon etc etc, or even the audio/mp4 for radio streams). are the docs so incomplete? or is this simply a trial and error thing, on undocumented possibilities

Hi, i’ve samsung tv 65ks7000 but volume set is always 0 and if i try to change it don’t works, can you help me?

The type option parameter in the shortcut object maps to media_content_type in this card. The card does no computations or modifications to the type but sends it directly to the backend as media_content_type

I’m not sure if the docs are incomplete or not, I believe they might be complete for the available official components. The supported types are platform specific and may vary depending on the component.
The Alexa component is custom so I guess that’s why you don’t see those types in the docs.

Hey, the samsungtv component doesn’t support volume level and setting a specific volume afaik, it does only support vol up/down/mute.
You can use the card option volume_stateless: true to switch out the volume slider for volume buttons, which should work in this case.

1 Like

this does not seem to be completely in line with what HA states about that:

content_id is platform dependent, content_type must be one of the mentioned options. So why ‘audio/mp4’ would be valid is rather unclear. I have btw set it to ‘music’ now, to be fully compliant, and can report it to work fine, even for playin radio-streams.

do think it would have been better to use ‘audio’ instead of ‘music’ , since not all media is music, but that’s being picky I guess :wink:

Anyways, thanks for helping me. (again)

1 Like

Hi @kalkih, thanks!

Another question, i can’t change icon (default icon is the same of chromecast) and i don’t view when tv stay on or off by the icon

If you want to change the icon:

icon: mdi:television

If you want the icon to change color depending on state (on/off):

hide:
  power_color: false

Sorry if I didn’t understand the question.

Thanks but i modified that:
hide:
power_state: false

and now i see icon change

thank you! Good job

Yeah sorry, should of course be power_state :+1:

When will this be merged into the main HA branch?

Hi, been having lots of fun with your mini player, thank you very much for this gem.

Basically, with some scripts and automations, the Harmony Hub auto-power-off for unused devices based on input select, is working fine without any Harmony Hub. Got 3 Denons, a few TVs. a 6 channel Monoprice amp, DirectTV, Sonos, Spotify, Chromecast, FireTV, and what not, all working nicely and reliably. Thank you again.

A feature request: support sound_mode selection. Could be another option to the shortcut_item type var


Two cosmetics: make the “Select Media” string in the shortcut_item list feature an optional string.
Finally, when a card is just a volume slider, when hidden if power off, then it still takes vertical space.

Did I mention I really like your work? -thanks!

Thank you, happy you find the card useful.

Sure, great idea. Would be cool to have sound select next to source select, but there’s unfortunately not enough space for it there.
Adding it as an optional type in the shortcut item object would be the next best thing I guess.

Sure.

Okay, I’ll look into that, I tend to always wrap those inside conditional cards so the slider card only shows when the player is active.

Would be great if you could open these as issues in the GitHub repo, that way I won’t miss or forget them.

Thanks!

Karl,

Thank you for your consideration. Rather than jumping into GitHub with a specific request, I’d like to flush this out a bit.

1: sound selection

Very happy you are willing to consider this. I implemented this using buttons to call scripts (lots of scripts: 11 sound modes on Denon’s, X 3 receivers)

Using buttons: 11 buttons takes just to much space
Using lists: The current static "Select media
’ is not ideal as mentioned previously. Also, the drop down list would look better aligned under the down arrow (on Chrome it is to the left margin of the card). They same way the source select list drops down is the way to go, I think.

Using the “unfiltered” or entire list of inputs or sound modes are not good under some circumstances:
Denon: some models do no allow you to hide sources, thus you may get 15 sources offered, of which only few are used. Shortcut buttons/lists allows for trimming the list.

Similar for sound modes: For most use cases, “Stereo” is not needed, “Mch Stereo” is the way to go.

A source and sound mode on the top next to the on/off button would be great, as you pointed out. To me, it looks like there would be space. Also, having the current source and sound mode next to the drop down arrows would be sweet.

For the list mode: show the current selection (source or sound mode; maybe an arbitrary entity attribute) to the left of the selection arrow(s). And, is there a way to eliminate the long underline? As mentioned previously, making the “Select media
” a variable would allow the list feature to be used for source, sound mode, and ?

2: Volume slider only card:

I also only show the slider when player is active. What I am seeing is vertical space taken even with player inactive/slider not shown.

3: Additionally, I noticed you generalized the sonos/speaker groups, nice. While the number of users are likely low, the Monoprice 10761 is a 6 channel house amp, get up to three for 18 channels. The HA component is solid. I’ve been using it for a few months without any issues. If you got nothing to do for a small user base, it might connect nicely under your speaker groups.

4: I just noticed where you live, nice place. I grew up in Copenhagen, but have been in the Seattle area for many years. Been to your home town a couple of times many years ago.

I am hopeful the suggestions and nit picks are taken constructively, -sure appreciate your work a lot !

image
I have my Surround Sound processor (Rotel RSP-1570) set up with the Mini Medi Player card. Added five buttons to display my speakers. Speaker used depends on the source mode. Stereo FL and FR. Surround mode all speakers. Attributes on the Rotel media_player entity gives me which speaker are one or off.

Is it possible to add color to the buttons, or hide the buttons depending on state/attribute value, or toggle the button on/off?

entity: media_player.rotel_rsp_1570
hide:
  controls: true
  power_state: false
type: 'custom:mini-media-player'
shortcuts:
  columns: 3
  buttons:
    - icon: 'mdi:speaker'
      name: FL
      type: script
      id: script.dummy

Yep, shortcuts were initially only used to trigger media playback, hence the label, but as you said, It’s not really fitting anymore.
I’ll add an option for a custom string in the shortcut object, and change the default to something else.

I’ve now changed it to be aligned to the right, similar to the source select.

The problem is that the card has to be very responsive, in order to play nice in different column setups and screen sizes, so while it could potentially work when the card is full or close to full width, it won’t when horizontal space is limited.

We also have to consider all possible card configurations and how they affect the layout.

Yes, this is a great idea, as long as the attribute is coming from the card entity I see no problem implementing this, could also be used to show “active” shortcut button.

Might potentially remove it, added it to follow the core HA dropdown design, but might look better without.

Not sure if you followed what I meant but I’m wrapping the “volume slider card” inside of a conditional card, that way it doesn’t render at all when the entity state is off.

- type: conditional
  conditions:
    - entity: media_player.avr_tv
      state_not: 'off'
  card:
    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

But yeah, It’s primarily the card paddings that still occupy space, but even with those removed, the card is still going to be rendered and assigned a card margin by HA. I would recommend using a conditional card to solve this, as in my example above.

Could you please send me a link to the component?

Oh, that’s cool, it’s a small world! :blush:

Thank you for the feedback and suggestions, appreciate it!

Cool idea.

No it’s not possible unfortunately, if you need more advanced button functionality I would recommend looking at the custom button-card.

You could then potentially wrap your mini-media-player and your button cards inside something like the vertical-stack-in-card or the standard vertical-stack to achieve sort of a single card look.

Karl,

Here is the link to the Monoprice amp component: https://www.home-assistant.io/components/monoprice/

I’ll try the conditional card approach you suggested.

Thank you again very much !

1 Like

This is probably the best card out there, love it :smile:.

I have been trying to figure out a way to use the grouping where I can change the master in my sonos group without having to add additional cards for each media player. All my paths leads to failure and I have concluded that I suck at this.

Any ideas how I could do this? Anyone that has done it?

Thanks :slight_smile:

1 Like

Karl,

Noticed your sound mode commits, thank you very much. Look forward to giving it a spin.

All the best !

1 Like