Lovelace: Mini Media Player

Cheers man! :smiley:

I think so! Now I understand how to do this!
Thank you!

My setup for LMS radio stations is even simpler. With LMS playing a station look in the states page of Dev Tools. There is an attribute for example

media_content_id:http://radionz-ice.streamguys.com/national_aac64`

Then my Mini media player yaml contains

shortcuts:
  buttons:
    - id: 'https://stream-ice.radionz.co.nz/concert_aac64'
      image: /hacsfiles/mini-media-player/rnz.png
      name: Concert
      type: playlist
    - id: 'http://radionz-ice.streamguys.com/national_aac64'
      image: /hacsfiles/mini-media-player/rnz.png
      name: National
      type: playlist
  columns: 4

Same issue after upgrading to HassOS 4.1 and to Home Assistant 0.111.3
Works in most browsers except Chrome is not displaying the icons for controls or power.

Recently I am not longer seeing artwork in my background. I’m not sure when it started, perhaps with 0.111.0. Anyone else experiencing this?

I have “artwork: cover” listed in the card configuration and haven’t changed it. Used to work and now doesn’t. Any ideas on what happened or what I need to do?

Thanks in advanced!

Ok, that is also possible and it works.

Isn’t there a possibility to use the favorites of LMS direct and not to define them again in HA? I don’t really like to care for the favorites on two places. :slight_smile:

I would be interested to know that too!

Fair enough, your approach is more straightforward, and one I hadn’t thought of.

But if the radio station changes the stream url (the BBC always seem to be doing this), I only have to edit an existing playlist through the LMS interface, rather than editing .yaml in Home Assistant. Although, it’s all just text editing in the end I guess.

And as a bonus, my script will play any existing playlist in LMS, not just radio stations.

Reading the CLI documentation for controlling LMS at http://your-lms-server-ip:9000/html/docs/help.html - this is what the squeezebox.call_method service uses - there does seem a way to play favorites directly, but it relies on first querying the LMS server for the id of the favorite, and it seems hellish complicated to me :frowning:

All my favorite radio stations in LMS are from tunein and I saw that the URL in LMS (Material Skin) direct looks always the same:

http://opml.radiotime.com/Tune.ashx?id=sXXXXXXXX&formats=aac,ogg,mp3&partnerId=YY&serial=ZZZZZZZZZZZZZ

XXXXXXX is what changes between the favorites. YY and ZZZZZZZZZZZZ are always the same.

So I can use your code to create a correct URL. And I hope that I don’t have to change the URL if the radio station changes their URL. I hope that tunein will do it for me.

Hello,
Thanks for the detailed report, there’s no image exposed by the entity from the looks of it? If that’s the case there’s nothing for the card to display.
What component is that entity of?
If it’s an official component and it used to expose artwork I suggest opening a issue in the core HA repo

I’m not sure what you you mean by component. They are media_player entitIt’s. In one case it is Netflix and the other Plex. Both are being played on different Chromecast devices. I do see null for picture. Why wouldn’t HA pass a long the picture?

Okay, the media player component/integration is Google Cast then.
I don’t know why it wouldn’t, but create an issue in the official Home Assistant GitHub repo.

Those are all good points! I am not much of a playlist kinda guy, being brought up on vinyl does that :slight_smile: My method was done in an idle hour or two during lockdown. After adding the grouping thing, I just thought the card is becoming super useful and I did the first thing that looked like it might work :slight_smile:

I probably should make some playlists and get them to work with this card.

What I do often do is play random songs or random albums (in LMS Home|Random Mix) - any idea how to do that in this card?

First: thanks for this great plugin, I really like the flexibility of it.
I’m running version 1.9.1 and 0.111.4 of HA
I tried the speaker_group function for platform squeezebox with Logitech Media Server Version: 7.9.1
The icon / group function does not appear, can you please help me?
This is my configuration (I double checked the entity names)

type: 'custom:mini-media-player'
entity: media_player.keuken_lms
name: Keuken muziek
speaker-group:
  platform: squeezebox
  entities:
    - entity_id: media_player.keuken_lms
      name: Keuken
    - entity_id: media_player.woonkamer_lms
      name: Woonkamer
    - entity_id: media_player.werkkamer_lms
      name: Werkkamer

speaker-group:

should be speaker_group: - underscore not hyphen.

Ashamed
 :blush:

Thnx!

Good question! After a bit of investigation, I managed to get the randomplay parameter working by using the squeezebox.call_method in the Services tab of the Developer Tools view.

So as a script, it would look like this (not actually tried this yet!):

squeeze_cmd_random_play:
  alias: 'LMS Command Random Play'
  sequence:
    - service: squeezebox.call_method
      data_template: 
        entity_id: 'media_player.{{ squeezebox_player }}'
        command: randomplay
        parameters: ['{{ type }}']

where squeezebox_player is the name of the player, and type is one of tracks, albums, contributors, year.

Then you could call the script from a button on Mini Media Player:

      - type: custom:mini-media-player
        entity: media_player.bedroom
        shortcuts:
          buttons:
            - name: 'Play Random Tracks'
              type: script
              id: script.squeeze_cmd_random_play
              data:
                squeezebox_player: bedroom
                type: tracks

or of course, and adapting the code slightly, any other type of button in Lovelace.

(You could also use the randomplaychoosegenre parameter to include/exclude specific genres from the existing Random Play setting on the LMS server, but that seems a bit laborious - quicker to just go to the LMS web view I would think).

1 Like

Thank you, that certainly works. Excellent. Looks easy when you see an example, but I would have spent half a day on that!

Using the card for my Sonos setup. I am trying to sync my volume between my Sonos speakers (speaker group), this seems to work when I use the sync_volume property within the speaker group yaml tag. When I try to use this in combination with volume_stateless it doesn’t seem to work. Putting volume stateless within the speaker group configuration doesn’t do anything, when I put it in the main entity configuration it does work for the main entity but it is not in sync anymore across the other speakers. Below my current card config.

entity: media_player.woonkamer_2
hide:
  icon: true
  power: true
  source: false
name: Sonos
speaker_group:
  entities:
    - entity_id: media_player.woonkamer_2
      name: Sonos Voorkamer
    - entity_id: media_player.achterkamer
      name: Sonos Achterkamer
  platform: sonos
  show_group_count: false
  sync_volume: true
type: 'custom:mini-media-player'