Flatten media player(s) into a group card

Same here. The default page is pretty much cluttered up with my sonos devices :frowning:
The old small media player layout would look much nicer imho.

Would be cool to have an option (in the customize.yaml?) to set the media player layout.

2 Likes

Agree. Seems to me that it would be possible to switch view based on yaml.

If you just want to save space, you can do so by removing the picture.

homeassistant:
  customize:
    media_player.living_room:
      entity_picture: ''
``
5 Likes

Thank you very much for that tip!
But unfortunately media player can still not be added to group state cards with this trick. :frowning:
And they still do not look as nice as with the old design imho :wink:

What is the goal? A state card with media control buttons? There is no such UI implemented.

A state card that shows the state of a player? Create a template sensor or a template switch.

I figured out a slight work around that works for me (buy may not for you). I can lean toward the minimalist side so I like to keep my main page in HA as slim as possible.

I have 5 chromecast devices around my home and I really only care about them if they are playing something. So I separated them all out into their own groups, added them to my main page and then run an automation to hide and un-hide them when they play things.

The Group:

	  plankton_main:
	    entities:
	      - media_player.plankton

The Automation:

	# Plankton Visable
	- alias: plankton visable true

	  trigger:
	    platform: template
	    value_template: "{{ not is_state('media_player.plankton', 'off') }}"

	  action:
	    service: group.set_visibility
	    entity_id: group.plankton_main
	    data:
	      visible: True

	- alias: plankton visable false

	  trigger:
	    - platform: homeassistant
	      event: start
	    - platform: state
	      entity_id: media_player.plankton
	      to: 'off'

	  action:
	    service: group.set_visibility
	    entity_id: group.plankton_main
	    data:
	      visible: False
6 Likes

My goal is the possibility to add media players to other state cards and show there actual status
(if possible with Album Covers/Images, like in the old way to show media players)

Sorry if this is maybe a stupid question, but I’m completly new to this templated sensor stuff.
Can you please give me a hint, what would be the correct code, if I just want the actual state (off, paused, playing…) from a media_player, as a templated sensor?

Thanks in advance for you help :slight_smile:

I have now found a way that is quite ok for me. For a quick overview in the default_view, I created templated sensors that reflect the current state of the respective mediaplayer.

  - platform: template
    sensors:
      sonos_wohnzimmer_state:
        value_template: '{{ states("media_player.sonos_wohnzimmer") }}'
        friendly_name: 'Sonos Wohnzimmer'

For a detailed view, I then created a separate view, in which I have moved all media player entities.

This is still not as nice, comfortable and informative as the old mediaplayer representation, but at least the default_view is no longer so cluttered.

BTW: Does anyone know how I can change the color of the templated sensors similar to that of lamps? (yellow if a media player is currently playing and grey for all other states).

3 Likes

Hi.

How did you put in the custom icon the the media-sensor like Chromecast? Normally i have no issues with this kind of changes, but my sensores jut won’t change - i just got an blank icon, if i define what kind of icon i would use.

Could you please share that part, too?

I did try with both customize and the icon_template, with no luck inspired of the home-assistant page:

 media_state_tv:
    value_template: '{{ states("media_player.samsung_tv_remote") }}'
    icon_template: >
      {% if is_state('media_player.samsung_tv_remote', 'on') %}
        mdi:cast
      {% elif is_state('media_player.samsung_tv_remote', 'unknown') %}
        mdi:tv
      {% else %}
        mdi:tv
      {% endif %}

And the customize (in one of my packages):

homeassistant:
customize:
sensor.media_state_tv:
friendly_name: “Tv”
icon: mid:television

The name is viewed just fine, but not the icon.

That’s because it’s mdi not mid: … icon: mdi:your_icon

Sure thing! Damn.

But what about the template > icon_template part?
(In a package)

sensor:
  - platform: template
    sensors:
      media_state_tv:
        value_template: '{{ states("media_player.samsung_tv_remote") }}'
        icon_template: >-
          {% if is_state('media_player.samsung_tv_remote', 'on') %}
            mdi:cast
          {% elif is_state('media_player.samsung_tv_remote', 'unknown') %}
            mdi:tv
          {% else %}
            mdi:tv
          {% endif %}

The TV-state sensor is showing up, and the text is OK too, but no icon shows up:
image

As far I can see the tv icon doesn’t exist so wouldn’t be displayed :frowning:

It’s an alternative-name, but i will give mdi:television a try.

That should work or television-classic.

1 Like

I created an index of home automation related icons you can use.

You can access it immediately here:
https://cdn.rawgit.com/james-fry/home-assistant-mdi/efd95d7a/home-assistant-mdi.html

Or can also install it as a panel iframe - instructions here:

3 Likes

M8. It’s like you are looking into my change-log (o: I actually added it a few hours ago.

@keithh666 - Thanks for your input. I actually think that i have used alternative names in the past? But… Well, now it’s working. What a waste of time :smiley: (Debugging for more than a few hours).

1 Like

Any luck making this happen?

EDIT: Looks like the solution is the universal media player platform.

2 Likes

Why can’t this just be reverted? It seems nobody likes the current ui for media players.

2 Likes

@eddi89 made a Custom UI Mini media player. Still in beta, though, but give it a try if you wish and help him work out the bugs :wink:

2 Likes