Lovelace: Mini Media Player

And for the sake of the card it shouldn’t matter if the component returns the group attribute as an empty array, a null value or if the attribute isn’t set at all, the card will handle all those cases as an empty array internally.

True. That’s probably why I didn’t notice this difference before trying to add binary sensor to achieve the conditional conditions to show the card or not. Anyway, this should be ok now, think it is for the best if the players behave similarly.

Is this the service call when you press the leave button in the mini-media-player card? service_data shouldn’t be empty right?

Yes, when the leave button is used as opposed to using the checkboxes or the ungroup on a master. I’m not sure, but I kindof suspected the empty service data to be the problem, but if it is working with Sonos it may very well be within my code. But it seems like it stopped the code before entering my service scripts, so it may be possible that this specific “Leave” function is not working on Sonos as well. Anyone with Sonos out there that could test?

Here’s a build of the card with the typo fixed if you have time to try it https://gist.github.com/kalkih/7f6161ca2e21cdbc66ac85cb6b9264e5

1 Like

Hi All - is anyone successfully using the scale: option? I’m not having any success and wondering if I’ve made a simple mistake somewhere.

      - type: custom:mini-media-player
        entity: media_player.tv
        name: TV
        info: scroll
        artwork: none
        max_volume: 30
        scale: 1.5
        hide:
          volume: true
          icon: true
          source: true
          power_state: false
          controls: false

Hello,
The config looks correct.
Make sure you’re at least on version v1.5.0 of the card, try clearing cache if you’ve manually installed the card.
If you’re using HACS please check this issue as it’s relevant for this card as well

Thank you! It was the HACS issue that you mentioned. I appreciate the fast response and the excellent card! :slight_smile:

1 Like

Thanks!
My problem was indeed related to the issue you mentionned. I didn’t see the package name update and I kept using an old version of the card without noticing it.
If I may suggest an improvement: the ‘idle’, ‘standby’ and ‘unknown’ states are considered as active. It could be interesting to have the option to choose which states are considered as active/not active.

If you don’t mind using the “idle view” feature in the card you could solve it that way, at least for idle and standby.

- type: custom:mini-media-player
  idle_view:
    when_idle: true
    when_standby: true

We should possibly change the default behaviour to display the icon as “off” if state is either idle and/or standby, what do you think? Could possibly check how it’s done in HA by default and follow that.

As for unknown, I’m not really sure what that means or how we should handle it, does unknown mean that the device is unreachable/disconnected from HA?

Thanks, the ‘idle_view’ features does the trick. Is there a way to remove the ‘idle’ label next to the player name ?

I don’t know if you should change the default behaviour of the icon. Some components report a correct state : a PS4 in actual standby mode / sleep mode reports Standby. However, a Nvidia Shield in idle mode (just showing a screen, app opened without anything playing etc.) will also report it as Standby. I don’t think the various media players follow a standard for state naming … The best is probably to provide configuration options to the user.

For unknown, my PS4 component reports this state when it is unreachable. However, with the icon_state option, the icon shows the device is ‘ON’. Most other media player (Nvidia Shield, Google Home) report this as unavailable, and your card handle it well.

@Morgane Thanks for your input!

If you don’t mind using card-mod:

- type: custom:mini-media-player
  entity: media_player.example
  style:
    mmp-powerstrip:
      $: |
        .label {
          display: none;
        }

Okay! I’m hesitant to handle unknown as unavailable because I suspect there could be instances were a component reports the state unknown for more reasons than unreachable. I’ll need to look into the HA source to see how it’s generally handled.

I would like to change the artwork based on the state, if playing I want to use a small cover art, if it is not playing no art, if I want to click on the small art then the full-cover-fit will be displayed. This is the functionality I have with my control4 and I would love to replicate that. Is this possible? Thanks again and love the work you have been doing!

Thanks ! I will have a look at card-mod

Hi @kalkih! Sorry for the delay, I was having some busy days. I tested your file, and the “leave” button seems to be working fine with my Heos integration using the demo-version. Thumbs up!

1 Like

Hi guys, can i change the icon of the mini media player with an image? I’ve changed it in the customize.yaml but in player there’s always the standard cast icon. If i click on the player, i correctly see the image:

Here’s my config of the player:

cards:
artwork: none
background: /local/Sky.png
entity: media_player.skyq_mansarda
hide: ‘volume:true source:true power_state:false’
name: Sky Q Platinum Mansarda
source: icon
info: scroll
shortcuts:
buttons:
- icon: ‘mdi:arrow-up-box’
id: CHup
name: CH+
type: source
- icon: ‘mdi:arrow-down-box’
id: CHdn
name: CH-
type: source
- id: Sky
image: /local/Sky.png
type: source
- icon: ‘mdi:home-outline’
id: Home
type: source
- icon: ‘mdi:exit-to-app’
id: Dismiss
type: source
- icon: ‘mdi:keyboard-return’
id: Select
type: source
- icon: ‘mdi:arrow-up-thick’
id: Up
type: source
- icon: ‘mdi:arrow-down-thick’
id: Down
type: source
- icon: ‘mdi:arrow-left-thick’
id: Left
type: source
- columns: 1
hide_when_off: true
icon: ‘mdi:arrow-right-thick’
id: Right
type: source
type: ‘custom:mini-media-player’
type: vertical-stack

Strange behaviour here: the card works great on its own, except if I add it inside a conditional card. It shows up, and everything works, except for the grouping. I cannot group/ungroup as it states that it cannot find the service sonos/join, but I have HEOS, not SONOS. The card works perfectly outside the conditional card…

Cannot call the service sonos/join: service not found

My code:

card:
  artwork: cover
  entity: media_player.speaker1
  hide:
    icon: true
    power_state: false
  platform: heos
  show_group_count: true
  source: icon
  speaker_group:
    entities:
      - entity_id: media_player.speaker1
        name: speaker1
      - entity_id: media_player.speaker2
        name: speaker2
      - entity_id: media_player.speaker3
        name: speaker3
      - entity_id: media_player.speaker4
        name: speaker4
  toggle_power: false
  type: 'custom:mini-media-player'
conditions:
  - entity: media_player.speaker1
    state_not: idle
  - entity: media_player.speaker1
    state_not: 'off'
type: conditional

Am I doing something wrong here?

Thanks
Cadish

Nice setup!
Unfortunately not currently possible to change it to an image but could possibly support in the future!
I personally like the look without an icon, try it!

hide:
  icon: true

Hello, you need to set the platform option inside the speaker_group object unless you’re using sonos (which is default).

show_group_count also need to go inside the speaker_group object, but it’s true by default so wouldn’t make a difference in your case!

  speaker_group:
    platform: heos
    entities:
      - entity_id: media_player.speaker1
        name: speaker1
      - entity_id: media_player.speaker2
        name: speaker2
      - entity_id: media_player.speaker3
        name: speaker3
      - entity_id: media_player.speaker4
        name: speaker4

That was it, it works now.

Thanks a lot!
Cadish

Hi, firstly big thanks to the amazing effort that has gone into this. A lot of people talk about this app replacing their sonos/spotify apps for multi-room sonos…

Can I ask a rather dumb question - this card seems to cover playback + shortcuts to e.g. predefined playlists - afaics, no-one has actually create an embedded search tool for spotify (or other sonos sources like tunein radio) which would really be required to avoid ever needing to use the apps? Assuming this is indeed the case, how does everyone manage this practically? Do they switch back to the other apps to find new music? If that is the case, would it not be possible to include embedded shortcuts to the spotify and/or sonos app from the lovelace card itself?

Thanks v much and apols if I am missing something obvious.

1 Like

Hi guys.
I started using the mini-media-player and it works great, but i have a question about artowork

Does it works with Netflix? i’m streaming from my phone to the chromecast, but i dont see any artoworks (i have “artwork: cover” in my entity).

What i can try to have an artwork showing to test it?

Thank you!

Yes that’s correct, the shortcuts are only really useful for predefined stuff, I personally tend to listen a lot to my “Daily Mixes” on Spotify and the shortcuts works great for pre-defined stuff like that as you said. As for discovering new music, no there’s no real solution to browse music services from within HA afaik.

As for navigating to the Spotify app from the card you could use the tap_action to open an app url when you tap the card, this works for me on Android 10:

tap_action:
  action: url
  url: spotify:album

I’m not sure about Sonos but they might have a similar URI scheme.

I don’t think so.
If I recall correctly Netflix does not provide any artwork through its cast service, It doesn’t even show up in the Google Home app if my memory is serving me right.

Try Spotify, it provides artwork.

@kalkih need help with some setup please.

i have 2 google speakers and 1 speakers group (of the 2 google’s).

The scenario of my setup:

  • or one of the google play source (spotify)
  • or they play the same source (spotify) using the speakers group.

i will not have scenario that each speaker play different source.

currently i have this setup:

        - type: vertical-stack
          icon: mdi:boombox
          cards:
            - type: entities
              entities:
              - entity: media_player.speakers
                type: "custom:mini-media-player"
                group: true
                show_tts: google
                artwork: cover
                power_color: true
                scroll_info: true
              - entity: media_player.googlehome2196
                type: "custom:mini-media-player"
                group: true
                show_tts: google
                artwork: cover
                power_color: true
                scroll_info: true
              - entity: media_player.kitchen_speaker
                type: "custom:mini-media-player"
                group: true
                show_tts: google
                artwork: cover
                power_color: true
                scroll_info: true

Can i use only 1 row of player and it always present the last playing source and device?