Lovelace: Mini Media Player

Yes.
If we skip the volume part of your script the script would look something like this:

# Example radio script
radio:
  alias: play media on entity
  sequence:
    - service: media_player.play_media
      data_template:
        entity_id: "media_player.{{ entity }}"
        media_content_id: "{{ content }}"
        media_content_type: audio/mp4

And the shortcut buttons, you could use the list shortcuts as well.

# Example shortcuts for script with variables 
buttons: 
  - name: some radio station
    type: script
    id: radio
    data:
      entity: chromecast_group
      content: http://ic6ti.scahw.com.au/6ppm_128
  - name: another radio station
    type: script
    id: radio
    data:
      entity: chromecast_group
      content: http://streaming.novaentertainment.com.au/nova937
2 Likes

Ah right, I understand how you are doing that now. Thanks for the example

1 Like

Yaaaay!! Thanks for adding it so fast. \o/

Hello there

I have been reading through this topic but not found a solution for me or just not seen it.

But i have my homeassistant installed on a ubuntu in a virtual venv with python 3.
I have got lovelace working and with yaml just. then, when i have to use mini-media-player, it says that i have to place it in a folder called /local/ but i dont have a folder called that, unless i go futher back into some more system specific files.

Anybody knows where I should place it when it is not called local?

I know the interface and desktop is on this location when comming from the folder i can go the furthest back to: /home/“user”/

Karl, been working away with your latest, thank you!

One thing got me stumped is how to use a entity attribute with conditional cards. Realize this is not a player issue. Similar queston for state-switch. Have you gotten away with this? I get “Error in card configuration.”

> - type: conditional
>     conditions:
>       - entity: media_player.erik_receiver
>         state: 'on'
>       - condition: template
>         value_template: "{{ is_state_attr('erik_receiver', 'source', 'DirecTV') }}"
>     card:
>       type: 'custom:vertical-stack-in-card'
>       cards:
>         - entity: media_player.erik_directv

config/www/

If /www does not exist, create it and restart HA.

would you say it doens’t matter where i create this folder? :smiley:

No I would not say that. Because it is not true. /www must be in your /config folder.

hmm
 ok
thats also a problem, because every folder that have something with homeassistant or at least where i enter to go to configuration.yaml, does not have a folder called config


Every HA instance has a /config folder. It’s where your configuration.yaml file is.

Edit: I learned something today.

hmmm
 ok, my folder where configuration.yaml is, is called “.homeassistant”. And i have just tried creating a new folder called www in that one and placed the bundle there and in the config folder itself, and changed the directory in the yaml-file. but nothing happened? :smiley:

Did you restart HA?

And my apologies. According to this:

The place your /www folder should be is in ~/.homeassistant

Ok, it works now. Thank you very much.

When i changed the location path back to local instead of the actual path in the ui-lovelace file and placed the bundle in www in .homeassistant and restartet, it worked :smiley:

1 Like

Yeah the restart after creating /www (in the correct place) is important.

1 Like

As far as I’m aware the conditional card does not support template conditions or attributes, only conditions accepted are state === * and/or state !== *, I believe (docs).

You could easily circumvent this by creating a simple template sensor based on the source and then use that template sensor in the condition.

# example of template source sensor
- platform: template
  sensors:
    spotify_source:
      friendly_name: "Spotify Source"
      value_template: "{{ states.media_player.spotify.attributes.source }}"
# example conditional card
- type: conditional
  conditions:
    - entity: media_player.spotify # there's no real `on` state so not `off` & not `unavailable` will do.
      state_not: 'off'
    - entity: media_player.spotify
      state_not: 'unavailable'
    - entity: sensor.spotify_source
      state: 'desired source'
  card:
    type: custom:mini-media-player
    entity: media_player.spotify

What is state-switch? I’m not familiar with that.

I’m using v1.1.0, how can I have the behavior of removed icon_state option?
I use shuffle icon and it was very useful to have the icon color changing with the state of shuffle attribute.

Been away from HA a while but have just picked it up again and see nice progress with this great card. Grouping of speakers is great!

I have three things I would like to get help with


  1. I don’t see the progress bar while playing. If I pause my Sonos it appears. I have show_progress to true and its now configured under hide.

  2. I have the shuffle button visible but I cant tell if shuffle is on or off. Is there anyway to make the icon tell if shuffle is on or off?

  3. Can you add a repeat button with the states “off”, “repeat all” and “repeat song”?

Hey, icon_state is actually not related to this, just poorly named, what icon_state did was changing the color of the entity icon when the entity was playing something.

This is a bug and is affecting the power button state as well, thanks for reporting. Was an easy fix.
https://github.com/kalkih/mini-media-player/commit/820eb029557b988734ea362b52948e5ef05c6a1c

Expect a new release in the next few days.

Hey, progress is now displayed by default (there’s no show_progress option) if you don’t explicitly set progress: true inside the hide object option. Could you try clearing your cache and see if the issue still persists, might be a bug, haven’t been able to recreate it yet though.

This is a bug introduced with the latest release, thanks for letting me know, see my response above.

Repeat is not supported by the backend components in HA (at least not yet), and therefore not possible to add to the card, unfortunately.

Okay, this was actually related to the same bug as the icons not showing accent color when active, new version with a fix available in the next few days, hopefully tomorrow. :+1:

@ktd @elle2 If you want a fix meanwhile, setting mini-media-player-accent-color: var(--accent-color) in your theme will make the accent color display properly for icons/progress bar.