Dashboard: Sonos card

Thanks - I have had SOME success here but it’s not super obvious to me how to just straight up hide a section. I’ve been digging around finding the bits I can configure and basically making a garbage looking dash just to capture some of them (example below). One thing I can’t sort out is the name for the color of the player control buttons in the highlighted or un-highlighted state (moused over or not). I think having all of the variables captured somewhere will make life easier for people trying to skin this thing a bit which I’ll continue to work on here. Any hints on the player buttons?

type: custom:sonos-card
skipAdditionalPlayerSwitches: true
disableDynamicVolumeSlider: true
styles:
  player-info:
    '--sonos-int-player-section-background': '#e5910980'
    '--sonos-int-artist-album-text-color': white
    '--sonos-int-song-text-color': white
  media-controls:
    '--sonos-int-player-section-background': '#e5910980'
  media-controls-icon:
    '--mdc-icon-size': 26px
  player-container:
    margin-top: null
1 Like

Unless I misunderstand, I believe you are overcomplicating it. Simply hide whatever element with display: none. Example:

styles:
  player-body:
    display: none

/PunxaPhil
BMC

Sorry - I kinda conflated a few things.

  1. Hiding (got it, thx!)
  2. general styling, finding some of the right things to set is hard

I’m open to suggestions! Could we start a discussion (or issue) on Github?

Thanks for a wonderful card and all the users in this thread for lots of ideas. I know nothing about CSS or other such mechanisms so pretty much just run the vanilla card.
I have one hope for a future versions.

  1. Would it be possible to have both the title section and play controls section be pop-up type? That way the full album art could be seen and a mouse over could be used to get those sections to open up. Maybe even with a pin on each if you wanted to pin them open.

Now to expose my lack of knowledge. I’ve tried my best to use these settings (copied from this thread) to get the song tile/artist information to be black/larger/bolder so these older eyes of mine can read them easier. I have currently -

Sonos

sonos-background-color: var(–secondary-background-color)
sonos-ha-card-background-color: none
ha-card-box-shadow: none
sonos-artist-album-text-color: rgb(192, 192, 192)
sonos-title-color: rgb(198, 203, 210)
sonos-color: rgb(198, 203, 210)
sonos-player-section-background: rgb(32, 33, 36)
sonos-accent-color: rgb(198, 203, 210)
sonos-song-text-color: rgb(192,192,192)

But they still are hard to read for me.

Thanks again!

You shouldn’t need to know CSS really, there is a detailed example in the documentation in the first post for styling. Showing you how to change color and font weight. Here is another example:

type: custom:sonos-card
styles:
  player-song:
    color: black
    font-weight: bold
  player-artist-album:
    color: black
    font-weight: bold


BMC

1 Like

Hi all:

Every time I try to play a Spotify playlist through this app, nothing plays. On occasion, I’ll see the following error at the bottom of my screen:

Failed to call service media_player/play_media. Error calling SonosMediaPlayerEntity.play_media on media_player.sonos_office: UPnP Error 711 received: Illegal seek target from 192.168.1.67

However, the Sonos apps on my computer or iPhone do work to connect to Spotify, so there’s something that’s specific to the Home Assistant integration that’s not working for me.

Not sure what I’m doing wrong here or if there’s a workaround to this. Anybody have any ideas?

Thanks

For some reason the card picks up my Yamaha AVR (TSR700). Any idea on why and how I can hide it? I do have to added as an integration and it does support streaming so maybe that’s why? In fact, if I could hide the Garage and Porch Sonos speakers I wouldn’t mind ;).
I added the speakers I want to have in the Groups specifically in the player card. Should I enter them somewhere else?


Thanks.

Guess I should try things before reaching out. Yes, adding to the Groups/Grouping cards resolved.

1 Like

How do you get the media control buttons in the middle of the image like that?

I can’t seem to figure this out… I would just like to use the custom:sonos-player card, and always play to the same 2 speakers. I would like to keep my dashboard minimalistic, so I don’t want to see the groups (I don’t need it because I always play to the same 2 speakers) and other panels.

The card keeps on asking for the entityId (which can to my knowledge only be 1 speaker)…

Yeah, not really what the card is designed for, but you can still do it that way if you just specify entity ID as the main Sonos player of your group

Is there a way to return the entity_picture attribute when the Sonos source is TV (Since this is not an attribute for the Sonos entity). A copy and paste of the current url shows what I am trying to achieve.

mediaArtworkOverrides:
  - mediaTitleEquals: TV
    imageUrl: >
      http://homeassistant.local:8123/api/media_player_proxy/media_player.android_fire_tv_max?token=6d62b9a179a97b241306fcdd791cbe69e9d224b59a62e37074db8964bbebf153&cache=1675042503.351415

When the source is TV, this is the entity_picture I would like from my Fire TV displayed:

{{ state_attr('media_player.android_fire_tv_max', 'entity_picture') }}

I have also written a template that returns the full URL as a state:

{{ states.sensor.fire_tv_max_screenshot.state }}

I know I cannot just whack a Jinga template into a js add-on, but played around with something like this:

mediaArtworkOverrides:
  - mediaTitleEquals: TV
    imageUrl: >
      [[[ return states['sensor.fire_tv_max_screenshot'].state[variables.backgroundImage]]];

Any ideas, or is this impossible without some major coding? :grinning:

I have tried adding the entity_picture attribute to the Sonos entity, but could not find a way around customizing being static and not being as the token changes.

Yeah, probably requires quite a bit of coding. Need to figure out how to support templates in card config :thinking:

Amazing work!, thank you for all your efforts! Is there any way to change the sort order of the favorites in the media browser card? Looks like it follows the order in which I added to favorites in the Sonos app but would be nice to have some sort of control. Basic ask would be A-Z sorting (via YAML not user-facing) but an even cooler feature request would be a way to manually (again, via YAML) control which favorites display and then use multiple media browser cards with custom titles. For example, one card shows radio stations, another card shows my wfie’s favorites, etc…

Any thoughts on if this would be possible or if others would find this useful?

Should be possible, please create an issue in Github and I’ll see when I find time


PunxaPhil

BMC

Hi! Is there a way to be able to add more then like 45 Icons in My Sonos, or maybe to be able to browse a local mediafolder in this Card? My local mediafolder is present in Sonos App, but I can´t see it in the card, so that I can browse the mediafiles. That would be great.

Hey, After a recent update the styles for this card seem not to be working anymore, I had the Volume Slider height increased which i really liked, has anyone experienced this issue?

Heres my code

entityId: media_player.living_room
singleSectionMode: player
skipAdditionalPlayerSwitches: true
disableDynamicVolumeSlider: false
styles:
  player-song:
    color: orange
    font-family: Helvetica
  player-volume-range:
    height: 3rem
  player-switch:
    height: 5rem 

Just started using this card.
1rst question how do I access the individual volumes?
2nd question what exactly do the icons in the grouping dashboard do…is it ungrouping a group?
3rd question can you define groups as an example “Main Floor” that would include sonos in different rooms on the main floor
3rd question answered sorry I missed it

groupingTitle: ''
predefinedGroups: # defaults to empty
  - name: Inside
    entities:
      - media_player.matrum
      - media_player.hall
predefinedGroupsTitle: 'My predefined groups' # default is 'Predefined Groups'

Yeah, I’m afraid I had to replace the previous volume slider implementation. It was hard to maintain. Now I am using the built in one from home assistant (paper slider). Not as easy to style though, but the default user experience is much better.