Lovelace: Mini Media Player

Yeah, squeezebox does not have this feature yet…

Annotation%202019-09-03%20163421

But, I have seen this feature incorporated in this setup. Would you look into this when you have some time?

Hi All,

First: awesome card!

I am missing something basic here, but I am struggling to add my Sonos favourites to the buttons.
All the code examples I find are with spotify as the source.
One of the options I tried so far is:

 - type: custom:mini-media-player
        entity: media_player.kitchen
        artwork: cover
        source: icon
        hide:
          volume: true
        shortcuts:
          columns: 4 # Max buttons per row
          buttons:
            # Start predefined playlist
            - icon: mdi:radio
              type: music
              id: "NRK Alltid Nyheter"
            - name: P2
              type: SONOS
              id: "NRK P2 100.0 (Community News)"

Hey, glad you like the card!

Most media platforms handle the media_play service call differently unfortunately, I’m not familiar with how the Sonos component does it but check this thread:

Seems like Sonos utilize the source select for favorites, so if this information is up to date you could either create buttons calling the source select service or use the source select that’s built into the card.

# source select button example
buttons:
  - icon: mdi:radio
    type: service
    id: media_player.select_source
    data:
      entity_id: media_player.sonos_entity
      source: 'Your favorite here I guess?'
1 Like

It is certainly possible with the LMS API, but I have not figured out how to incorporate it into the HA code.

This is made really nice !! Thank you very much for the development…

2 Likes

Good day, Just wanted to know if anybody else has experienced a bug with volume and power control for Amazon Echos since last release.

In my case the power button no longer starts/stops the player and the volume in the volume_stateless: true conditon reports this error:

2019-09-07 21:46:20 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.22930521813776] '<' not supported between instances of 'NoneType' and 'int'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 210, in handle_service
    self._platforms.values(), func, call, service_name, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 349, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 371, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 778, in async_volume_up
    if self.volume_level < 1 and self.supported_features & SUPPORT_VOLUME_SET:
TypeError: '<' not supported between instances of 'NoneType' and 'int'

thank you

There has been no changes related to volume/power behaviour in the latest releases of this card which makes me believe this is backend related, you didn’t happen to update HA or the alexa media player component recently?

Do the issues also occur in the default media-control card and in the more-info popup as well?

I believe you’re right. I am in deed in HA 98.4 and the latest alexa media player.
The problem is persistent in the default media-control card.

thank you for your prompt reply.

1 Like

This feels like a stupid question, but I’m rebuilding my HA from scratch - trying to add this custom card back in, but the github .js source only ever loads as singe-line run-on text in the hassio configurator. How can I get a copy with correct formatting to load? Thanks!

all @kalkih cards are a single line when you download them. That’s how they are meant to be

Oh good! Thanks, for some reason thought that was going to be problematic :man_facepalming:

You might like to think about using HACS to load stuff like this.

2 Likes

Thank you very much!
That was exactly what I needed.
Had something similar, but stopped as it looked so much more complicated than the other examples :slight_smile:

1 Like

@kalkih

First off, thanks for this great card! I was wondering how hard it would be as a feature request to add an option for big controls, something along the lines of the attached mockup. The reason is I’ve recently been using Google Cast and the controls are very tiny to touch quickly but if they were larger, I would be able to get to them quicker with less precision. Maybe even have the controls disappear after a few seconds to show the whole artwork when not using? Thanks in advance!

1 Like

Would it still be a mini media card then?

@nickrout not really sure how the name matters. It has options right now as a full-cover and full-cover-fit for artwork which doesn’t make it mini either

Is there a way to get borders and transparency on the entities?

It certainly is:

52

And it can all be done from within your theme:

# theme variables from the theme in the picture above
ha-card-border-radius: 10px
ha-card-background: rgba(150, 150, 150, .1)
mini-media-player-accent-color: var(--primary-text-color)
mini-media-player-overlay-color: rgba(255, 255, 255, .75)
mini-media-player-artwork-opacity: .25
3 Likes

@KoltesPunti All available theme variables can be found here (github).

The card also adopt default ha theme variables such as ha-card-border-radius, ha-card-background, primary-text-color, accent-color etc…

1 Like

U are the best :smiley: thx

1 Like