Lovelace: Mini Media Player

Hi can you post your working config for this example? thank you

Love this card! thanks.

I´m not sure if this is possible but I’m trying to set a shortcut to toggle an input boolean using service, but I can not get it done. I have read the GitHub page but can’t understand how to do it, this is my approach until now (doesn’t work):

artwork: cover
entity: media_player.tv
shortcuts:
  buttons:
    - icon: 'mdi:kodi'
      type: service
      id: input_boolean.turn_on
      data: netflix

My input boolean is called input_boolean.netflix

Appreciate any kind of help!

Anyone having this error after the latest 96.1 update?

2019-07-19 21:17:01 ERROR (MainThread) [homeassistant.setup] Setup failed for media_player: No setup function defined.

I’m using the Mini Media Player bundle as well, but it just stopped after updating from 95.4 to 96.1.

Hey, thanks!
data is an object, similar to how’d normally call services in scripts or automations.
I should probably add a service example to the readme!
And if you want to toggle the input boolean you could call toggle instead of turn_on

# this should do the trick
shortcuts:
  buttons:
    - icon: 'mdi:kodi'
      type: service
      id: input_boolean.toggle
      data:
        entity_id: input_boolean.netflix

That’s a backend issue, should not be related to this card in particular.
But if the entities aren’t registered and setup in HA, the mmp cards won’t show up either.

1 Like

OK I don’t know if I missed anything how to fix my TTS. i look allover this post trying to find what’s wrong with My TTS some ppl this is what I got.
Capture
Capture2
Capture4

this is my error. its look like its coming from the rest. do I really need that

HTTPConnectionPool(host='192.168.x.xx', port=5000): Max retries exceeded with url: /broadcast_message?message=hello (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fe87a34e550>: Failed to establish a new connection: [Errno 111] Connection refused'))
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 80, in create_connection
    raise err
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 70, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 355, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.7/http/client.py", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1290, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1239, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 183, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fe87a34e550>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 641, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 399, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.0.97', port=5000): Max retries exceeded with url: /broadcast_message?message=hello (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fe87a34e550>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service
    connection.context(msg))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1150, in async_call
    self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1172, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/components/notify/__init__.py", line 112, in async_notify_message
    await notify_service.async_send_message(**kwargs)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/rest/notify.py", line 138, in send_message
    verify=self._verify_ssl)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.0.97', port=5000): Max retries exceeded with url: /broadcast_message?message=hello (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fe87a34e550>: Failed to establish a new connection: [Errno 111] Connection refused'))
Failed to call service notify/ga_broadcast. HTTPConnectionPool(host='192.168.0.97', port=5000): Max retries exceeded with url: /broadcast_message?message=hello (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fe879bbf3d0>: Failed to establish a new connection: [Errno 111] Connection refused'))

also there is a file TTS that I just find
Capture

Hey, I guess the instructions could be clearer there but you actually need to have a google assistant webserver running on that IP in order for the google assistant tts to actually work (it’s basically a virtual google home).

One alternative is Community Hass.io Add-on: Google Assistant Webserver (broadcast messages without interrupting music) another is assistant-relay.

It’s a bit of a hassle to setup but it’s pretty neat to be able to play message on multiple speakers and/or without interrupting current playback.

fun this works
Capture5

Yeah, if you don’t care about not interrupting active playback/multiroom you can use google_translate or any other default tts component as the platform in mini-media-player and it will function similar to the default media pop-up.

all fix now I think some thing in the post said you have to have _say
lol I did try google_translate before lol fix now thanks you

Capture
Capture2

2 Likes

Great!
Oh yeah, it was changed from _say to _translate pretty recently I think!

1 Like

Hi. I Have question. You added the possibility for using artwork as bakground on the player. From where do you get the cover art? I am trying to figure out a way to get the coverart as buttons to start games and apps on my ps4. Is that provided with the game/app and not accessible when not started

Yeah, the cover art used in this card is provided by the active media source and often exposed by the media player component in the entity_picture attribute. And yeah, it’s probably not going to be accessible when there’s no app/playback started, some components could handle this differently I guess, but most i’ve seen seem to follow this pattern.

Hey,
I’m struggling with the playlists from Spotify. Currently the only one that works is the one provided in your example with the shortcuts.

When I open Spotify and click Share on the Playlist I get a full string with username id and playlist ID.
I think I have tried every single possibility now and every time I hit the button I just get:

http status: 502, code:-1 - https://api.spotify.com/v1/me/player/play:
 Bad gateway.

Can someone give me an example of their string from a playlist and point me to the exact thing I need to paste into the mini media player card?

Hey, here’s a quick GIF on how to find it on desktop.
If you use the share function on mobile I believe you’ll just get the URL, but you can find the unique identifier in that URL and if you know the structure of the expected URI, you can easily recreate it (see examples below).
15
Same thing for playlists, albums, artists, it’s the URI you want.

Few examples
Playlist: spotify:playlist:37i9dQZF1DWY4xHQp97fN6
Artist: spotify:artist:4MCBfE4596Uoi2O4DtmEMz
Album: spotify:album:6tkjU4Umpo79wwkgPMV3nZ

Thanks! Much appreciated!

I’m having a issue where my icon is disappearing when I power on the player. Has anyone experienced this? Also, is it possible to replace the power button with a toggle?

Hi,
I have seen that icon_state option was removed a few releases ago, and I can’t find a way to have my players icon color change when depending on the device state. Some devices do not always have artwork covers, so it’s not always easy to find out if it’s ON or OFF from HomeAssistant interface.
Is there a workaround ? Will it come back in a future release ?

Hey, are you using the power_state option? You could try settings the theme variable mini-media-player-accent-color to a desired color in your theme and see if that helps.
It’s not possible to switch out for a toggle, but you could always fork the card and add it if you’d like,

Hi, you could use the power_state feature (disabled by default), which will change the power button to your themes accent color when the device is powered on.

hide:
  power_state: false

The icon state feature might come back in the future, there’s a FR related to it here #144,

In next version of the card with the addition of the theme variable mini-media-player-icon-color you could probably achieve the desired functionality by combining config-template-card + card-mod, where you check the device state and set the icon theme variable accordingly.

@kalkih thanks that worked when using but, strangely, it doesn’t work on mobile?

Did it work even on mobile after you did that or just on desktop, and which browser(s) did you see the issue in?

Here’s my thoughts on the issue.
The card uses a kinda new feature in web dev called CSS custom properties, we use these to decide & set the colors the card should use. But when we add several fallback values to these custom properties, things start to behave strange in some browsers.