Dashboard: Sonos card

Sonos Card

Sonos Card for Home Assistant UI with a focus on managing multiple media players!

Features:

  • Group/Ungroup speakers
  • Control multiple speakers
  • Play favorites from list
  • Media browser button
  • Control individual volumes in a group
  • Artwork background
  • Possibility to override artwork
  • Shuffle and repeat mode
  • Theming
  • Configurable styling
  • Dynamic volume level slider
  • Track progress bar

and more!





Support the project

Do you like the Sonos Card? Support the project with a coffee :coffee:

BMC

Installation

With HACS (recommended)

Recommended way of installing this card is with HACS (Home Assistant Community Store).

Without HACS

  1. Download this file: custom-sonos-card.js
  2. Add this file into your /www folder
  3. On your dashboard click on the icon at the right top corner then on Edit dashboard
  4. Click again on that icon and then on Manage resources
  5. Click on Add resource
  6. Copy and paste this: /local/custom-sonos-card.js?v=1
  7. Click on JavaScript Module then Create
  8. Go back and refresh your page
  9. You can now click on Add card in the bottom right corner and search for Maxi Media Player
  10. After any update of the file you will have to edit /local/custom-sonos-card.js?v=1 and change the version to any higher number

Usage

Individual sections

By default, all sections of the card is available, and you can jump between them in the footer of the card.

However, you can also select individual sections to enable. Use this if you want to show the different sections next to
each other (by adding multiple instances of the card with different sections enabled).

By using the section configuration you can utilise the full power of Home Assistant’s layout capabilities and also drag in other cards in your Dashboard view.

Configuration

Use the Visual Editor in Home Assistant to configure the card. Most options are available there.

Configuration in YAML

type: custom:sonos-card
entities: # Entities are automatically discovered if you don't supply this setting
  - media_player.sonos_kitchen
  - media_player.sonos_hallway
  - media_player.sonos_bedroom
  - media_player.sonos_livingroom
excludeItemsInEntitiesList: true # Will invert the selection in the `entities` list, so that all players that are not in the list will be used.
showNonSonosPlayers: true # default is false, which means only Sonos players will be shown.

All settings below are optional

# common for all sections
title: ''
sections: # see explanation further up
  - volumes
  - groups
  - grouping
  - media browser
  - player
widthPercentage: 75 # default is 100. Use this to change the width of the card.
heightPercentage: 75 # default is 100. Use this to change the height of the card. Set to 'auto' to make the card height adjust to the content.
entityId: media_player.bedroom # Forces this player to be the selected one on loading the card (overrides url param etc)
entityNameRegexToReplace: ' PLAYER' # Regex pattern to replace parts of the entity names
entityNameReplacement: ''
volumeStepSize: 1 # Use this to change the step size when using volume up/down. Default is to use the step size of Home Assistant's media player integration. 
adjustVolumeRelativeToMainPlayer: true # default is false, which means all players will be set to the same volume as the main player. If set to true, volume will be adjusted relative to the main player in the group.

# groups specific
groupsTitle: ''
hideGroupCurrentTrack: true # default is false, which means song/track info for groups will be shown

# grouping specific
groupingTitle: ''
predefinedGroups: # defaults to empty
  - name: Inside
    volume: 15 # If you want to set the volume of all speakers when grouping
    unmuteWhenGrouped: true # If you want to unmute all speakers when grouping
    entities:
      - media_player.bedroom
      - media_player.hall
  - name: Kitchen&Hall
    media: Legendary # If you want to start playing a specific favorite when grouping 
    entities: # Use below format if you want to set the volume of the speakers when grouping
      - player: media_player.kitchen
        volume: 10
      - player: media_player.hall
        volume: 5
  - name: All (except TV)
    excludeItemsInEntitiesList: true # Invert entities selection, so that all players will be grouped except those in the entities list
    entities: 
      - media_player.tv
skipApplyButtonWhenGrouping: true # default is false. Will skip the apply button when grouping.
dontSwitchPlayerWhenGrouping: true # default is false. Will not switch to another player if main player is ungrouped.

# player specific
hidePlayerControlNextTrackButton: true # default is false, hides player control next track button.
hidePlayerControlPrevTrackButton: true # default is false, hides player control previous track button.
hidePlayerControlRepeatButton: true # default is false, hides player control track repeat mode button.
hidePlayerControlShuffleButton: true # default is false, hides player control track shuffle mode button.
hidePlayerControlPowerButton: true # default is false, hides player control power button if media player TURN_ON feature is enabled.  This setting does nothing if media player TURN_ON feature is not supported.
showVolumeUpAndDownButtons: true # default is false, shows buttons for increasing and decreasing volume
showFastForwardAndRewindButtons: true # default is false, shows fast forward and rewind buttons
fastForwardAndRewindStepSizeSeconds: 60 # default is 15 seconds
labelWhenNoMediaIsSelected: 'No media selected'
labelForTheAllVolumesSlider: 'All volumes'
mediaArtworkOverrides: # Show your own selected artwork if certain rules match
  - mediaTitleEquals: TV
    imageUrl: https://cdn-icons-png.flaticon.com/512/716/716429.png
    sizePercentage: 40
  - mediaContentIdEquals: "x-htastream:RINCON_949F3EC2E15B01400:spdif"
    imageUrl: https://cdn-icons-png.flaticon.com/512/4108/4108783.png
  - mediaTitleEquals: p4malmo-aac-192
    imageUrl: >-
      https://mytuner.global.ssl.fastly.net/media/tvos_radios/2BDTPrpMbn_cTdteqo.jpg
  - mediaArtistEquals: Metallica
    imageUrl: >-
      https://mytuner.global.ssl.fastly.net/media/tvos_radios/2BDTPrpMbn_cTdteqo.jpg
  - mediaAlbumNameEquals: "Master of Puppets"
    imageUrl: >-
      https://mytuner.global.ssl.fastly.net/media/tvos_radios/2BDTPrpMbn_cTdteqo.jpg
  - mediaChannelEquals: "Sky Radio Smooth Hits"
    imageUrl: https://cdn-icons-png.flaticon.com/512/4108/4108794.png
  - ifMissing: true # ifMissing will only be used if none of the "Equals" overrides above resulted in a match 
    imageUrl: https://cdn-icons-png.flaticon.com/512/651/651758.png
customSources: # Read more in 'Custom Favorites / Sources' section below
  media_player.tv: # set this to 'all' to show the custom source for all players
    - title: TV # Must match the name of the source (unless you specify media_content_id/type as shown below)
      thumbnail: https://cdn-icons-png.flaticon.com/512/716/716429.png
  all:
    - title: BBC
      media_content_id: media-source://radio_browser/98adecf7-2683-4408-9be7-02d3f9098eb8
      media_content_type: music
      thumbnail: http://cdn-profiles.tunein.com/s24948/images/logoq.jpg?t=1
dynamicVolumeSlider: true # default is false. See more in section further down.
dynamicVolumeSliderThreshold: 30 # default is 20. Use this to change the threshold for the dynamic volume slider.
dynamicVolumeSliderMax: 40 # default is 30. Use this to change the max value for the dynamic volume slider.
artworkHostname: http://192.168.0.59:8123 #default is ''. Usually not needed, but depending on your setup your device might not be able to access the artwork on the default host. One example where it could be needed is if you cast the dashboard with Google Cast.
showAudioInputFormat: true # default is false. Will show the audio input format (e.g. Dolby Digital) in the player section if available. By default, it will only show if the input format in the volumes section.
fallbackArtwork: https://cdn-icons-png.flaticon.com/512/651/651717.png # Override default fallback artwork image if artwork is missing for the currently selected media.
entitiesToIgnoreVolumeLevelFor: # default is empty. Use this if you want to ignore volume level for certain players in the player section. Useful if you have a main device with fixed volume.
  - media_player.my_sonos_port_device
artworkMinHeight: 10 # default is 5. Use this to change the minimum height of the artwork in the player section. Unit is in rem.
artworkAsBackground: true # default is false. Will show the artwork as background for the player section.
playerVolumeEntityId: media_player.bedroom # default is empty. Use this to control the volume of another player in the player section. Entity ID must the selected player or part of the selected player's group, otherwise it will not be controlled.
showSourceInPlayer: true # default is false. Will show the source (if available) in the player section.
showBrowseMediaInPlayerSection: true # default is false. Will show the browse media button in the player section.
showChannelInPlayer: true # default is false. Will show the channel (if available) in the player section. This can for instance be the radio station name.
hidePlaylistInPlayer: true # default is false. Will hide the playlist name in the player section.

# media browser specific
mediaBrowserItemsPerRow: 1 # default is 4. Use this to show items as list.
mediaBrowserHideTitleForThumbnailIcons: true # default is false. Only makes a difference if mediaBrowserItemsPerRow > 1. Will hide title for thumbnail artworks.
customThumbnail:
  Voyage: https://i.scdn.co/image/ab67706f000000027b2e7ee752dc222ff2fd466f
customThumbnailIfMissing:
  Ed Sheeran Radio: https://i.scdn.co/image/ab6761610000e5eb4d2f80ceffc6c70a432ccd7c
  Legendary: https://i.scdn.co/image/ab67706f000000027b2e7ee752dc222ff2fd466f
  fallback: https://cdn-icons-png.flaticon.com/512/651/651717.png # will use this if thumbnail is missing and none of the above matches. Defaults to black music notes with white background.  
favoritesToIgnore:
  - My Favorite Album
  - My Bad Playlist
topFavorites: # Show these favorites at the top of the list
  - Legendary
  - Country Rocks
  - Kacey Musgraves Radio
numberOfFavoritesToShow: 10 # Use this to limit the amount of favorites to show
hideBrowseMediaButton: true # default is false. Hides the button to open the media browser.
replaceHttpWithHttpsForThumbnails: true # default is false. Use this if you  want to replace http with https for thumbnails. 
mediaBrowserTitle: My favorites # default is 'All favorites'. Use this to change the title for the media browser/favorites section.

# volumes specific
hideVolumeCogwheel: true # default is false. Will hide the cogwheel for the volumes section.

Using individual section cards

As mentioned earlier, use the individual sections for more layout flexibility.

Here is an example:

type: horizontal-stack
cards:
  - type: custom:sonos-card
    sections:
      - groups
      - volumes
  - type: custom:sonos-card
    sections:
      - player
  - type: custom:sonos-card
    sections:
      - grouping
      - media browser

Theme variables

The following variables are being used and can be set in your theme to change the appearance of the card:

--accent-color
--primary-color
--secondary-text-color
--secondary-background-color
--disabled-text-color

Read more about using theme variables here: Home Assistant frontend - Home Assistant

Custom Favorites / Sources

You can add your own buttons to the Favorites section. This can be useful if you want to quickly start a specific radio station or playlist.

To determine what to configure for a button do the following:

  1. Start playing the radio station or playlist you want to add. This can for instance be done in this card’s media browser or in the built-in Home Assistant Media page.
  2. Open the Developer Tools in Home Assistant.
  3. Go to the States tab.
  4. Find the media player entity that is playing the radio station or playlist.
  5. Look for the media_content_id and media_content_type attributes.
  6. For the thumbnail, you can inspect the HTML to see what image the media browser is using, or you can also use a local URL if you have the image stored locally.
  7. Use these values to configure the custom source.

Example:
custom_sources.png

type: custom:sonos-card
customSources: 
  all: # 'all' means it will show for all players, otherwise specify the entity_id of the player.
    - title: BBC
      media_content_id: x-rincon-mp3radio://http://stream.live.vc.bbcmedia.co.uk/bbc_world_service
      media_content_type: music
      thumbnail: http://cdn-profiles.tunein.com/s24948/images/logoq.jpg?t=1

Dynamic volume level slider

The volume level slider is dynamically adjusting its scale. If volume is below 20% it will show a scale up to 30%. Above
20% it will show a scale up to 100%. The color will also change from green to red clearly indicating which scale is
being used.

Enable it in config with dynamicVolumeSlider: true

Linking to specific player

Append #media_player.my_sonos_player to page URL to have that player selected.

If entityId is configured for the card, the url param will be ignored. See more in the Usage section above.

CSS Styling

The recommend way to change look and feel is to use the built-in theming capabilities in Home Assistant. If that is not enough this card supports being styled with card_mod.

Example:

type: custom:sonos-card
card_mod:
  style: |
    ha-card {
      color: white !important;
      background: gray;
      --accent-color: pink;
      --primary-color: white;
      --secondary-text-color: white;
      --secondary-background-color: pink;
    }

The above YAML renders the following:

More card_mod examples

Example 1

Groups
card_mod:
  style:
    ha-card.type-custom-sonos-card>div.content>sonos-groups$mwc-list>sonos-group:
      $: |
        mwc-list-item[hasmeta] {
          background: var(--theme-card-background-glass);
          border: 1px solid var(--theme-card-border-glass);
          height: 61.4468px!important;
          border-radius: var(--theme-card-border-radius);
          margin: 12px 0px 0px 0px;
        }
        mwc-list-item[activated] {
          --mdc-ripple-color: none;
        }
        mwc-list-item>div>div>span:nth-child(1) {
          color: var(--primary-text-color);
          font-size: 14px;
          font-weight: 700;
          line-height: 15.4px;
        }
        mwc-list-item>div>div>span:nth-child(2) {
          color: var(--secondary-text-color);
          font-size: 12px;
          font-weight: 700;
          line-height: 13.2px;
        }
        mwc-list-item > div > ha-icon {
          color: rgb(var(--mush-rgb-disabled));
          background: rgba(var(--mush-rgb-disabled), 0.2);
          --mdc-icon-size: 30px;
          min-width: 40px;
          min-height: 40px;
          max-width: 40px;
          max-height: 40px;
          border-radius: 50%;
          display: flex;
          align-items: center;
          justify-content: center;
        }
        mwc-list-item[activated] > div > ha-icon {
          color: rgb(var(--mush-rgb-blue));
          background: rgba(var(--mush-rgb-blue), 0.2);
        }
    ha-card.type-custom-sonos-card>div.content>sonos-groups$mwc-list>sonos-group:nth-child(1)$: |
      mwc-list-item[hasmeta] {
        margin-top: 4px;
      }
    .: |
      ha-card {
        background: none;
        border: none;
        --accent-color: none;
        --primary-color: var(--primary-text-color);
        --secondary-background-color: none;
      }
Player
card_mod:
  style:
    sonos-player:
      $:
        sonos-player-header$: |
          .info .song {
            color: var(--primary-text-color);
            font-weight: 600;
            font-size: 20px;
          }
    .: |
      ha-card {
        --primary-color: none;
        --secondary-background-color: none;
      }
Grouping
card_mod:
  style:
    sonos-grouping:
      $: |
        ha-control-button {
          height: 36px;
          width: auto;
          min-width: 36px;
          border-width: 1px;
          border-color: var(--theme-card-border-glass);
          --control-button-background-color: var(--theme-card-background-glass)!important;
          --mdc-ripple-color: none;
          --control-button-background-opacity: 1;
          --control-button-border-radius: 18px;
        }
        ha-control-button span {
          color: var(--primary-text-color);
          line-height: 14.4px;
          font-weight: 700;
          font-size: 14px;
        }
        ha-control-button ha-icon {
          color: var(--primary-color);
          
        }
        mwc-list.list>mwc-list-item {
          background: var(--theme-card-background-glass);
          border: 1px solid var(--theme-card-border-glass);
          height: 61.4468px;
          border-radius: var(--theme-card-border-radius);
          margin: 12px 2px 0px 2px;
        }
        mwc-list>mwc-list-item:nth-child(1) {
          margin-top: 0;
        }
        mwc-list.list>mwc-list-item[activated] {
          --mdc-ripple-color: none;
        }
        mwc-list.list>mwc-list-item>ha-icon {
          margin-right: 10px;
          display: flex;
          color: rgb(var(--mush-rgb-disabled));
          background-color: rgba(var(--mush-rgb-disabled), 0.2);
          min-width: 40px;
          min-height: 40px;
          border-radius: 50%;
          opacity: 1;
          align-items: center;
          justify-content: center;
        }
        mwc-list.list>mwc-list-item[activated]>ha-icon {
          color: rgb(var(--mush-rgb-blue));
          background: rgba(var(--mush-rgb-blue), 0.2);
        }
        mwc-list.list>mwc-list-item>span {
          opacity: 1;
          color: var(--primary-text-color);
        }
    div.content>sonos-grouping$mwc-list.list>mwc-list-item:
      $: |
        span.mdc-deprecated-list-item__text>slot {
          display: flex;
          align-items: center;
        }
    .: |
      ha-card {
        background: none;
        border-color: transparent;
        --accent-color: none;
        --primary-color: var(--primary-text-color);
        --secondary-background-color: none;
      }

Example 2 - Resize volume and icons

card_mod:
  style:
    .: |
    sonos-player$ sonos-player-controls$ sonos-volume$: |
      ha-control-slider {
        height: 10px;
      }
      ha-icon-button {
        --mdc-icon-button-size: 2rem !important;
        --mdc-icon-size: 1.5rem !important;
      }    

Example 3 - Change the font and background color of grouping button

card_mod:
  style:
    sonos-grouping$: |
      sonos-grouping-button {
        --accent-color: black;
        font-size: 30px;
      }

Example 4 - Resize controls area in player section

card_mod:
  style:
    sonos-player$: |
      .controls {
        margin: 0 3rem !important;
      }

Example 5 - Hide entity/group name

card_mod:
  style:
    sonos-player$ sonos-player-header$: |
      .entity {
        display: none;
      }

Example 6 - More transparent title track and volume slider

card_mod:
  style:
    .: ''
    sonos-player$: |
      .controls {
        background-color: rgba(var(--rgb-card-background-color), 0.4) !important;
      }
      sonos-player-header {
        background-color: rgba(var(--rgb-card-background-color), 0.4) !important;
      }

Example 7 - Make the padding smaller around the artwork of the thumbnails in the favorites section

card_mod:
  style:
    sonos-media-browser$: |
      .button {
        --control-button-padding: 4px;
      }

Example 8 - Remove artwork in player section

card_mod:
  style:
    sonos-player$: |
      .artwork {
        display: none !important;
      }

Example 9 - Hide volume slider

card_mod:
  style:
    "sonos-player$ sonos-player-controls$": |
      sonos-volume {
        display: none;
      }

Example 10 - Hide background from controls when artwork is shown as background

artworkAsBackground: true
card_mod:
  style: |
    ha-card {
      --rgb-card-background-color: false;
    }

Example 11 - Modify transparency of background from controls when artwork is shown as background

artworkAsBackground: true
card_mod:
  style: 
    sonos-player$: |
      [background] {
        background-color: rgba(0,0,0, 0.3) !important;
      }

Example 12 - Show only player and now playing text information

heightPercentage: auto
sections:
  - player
card_mod:
  style:
    sonos-player$: |
      .artwork {
        display: none;
      }
      .controls {
        display: none;
      }

Example 13 - Style the favorite section

card_mod:
  style:
    sonos-media-browser$ sonos-media-browser-icons$: |
      div {            
        border: 1px solid white;
        color: red !important;
      }  

Example 14 - Color of the player controls

card_mod:
  style:
    sonos-player$ sonos-player-controls$: |
      .icons * {    
        color: pink;
      }

Example 15 - Remove the top “All favorites” and “Browse media” from the favorites section

card_mod:
  style:
    sonos-media-browser$: |
      sonos-media-browser-header {
        display: none;
      }

Example 16 - Change colors of titles in favorites

card_mod:
  style:
    sonos-media-browser$ sonos-media-browser-icons$: |
      .title {            
        color: red !important;
        background-color: blue !important; 
      }  

Example 17 - Remove everything except the album art

card_mod:
  style:
    sonos-player$: |
      sonos-player-header, sonos-player-controls {
        display: none;
      }

Example 18 - Hide the volume button and percentage

card_mod:
  style:
    sonos-player$ sonos-player-controls$ sonos-volume$: |
      .volume-level, ha-icon-button {
        display:none !important;
      }

Example 19 - Changing the font size of song title

card_mod:
  style:
    sonos-player$ sonos-player-header$: |
      .song {
        font-size: 1.2em; !important;
      }

Example 20 - Artwork position

heightPercentage: auto
card_mod:
  style:
    sonos-player$: |
      .container {        
        grid-template-areas:
            'header artwork'
            'controls artwork' !important;
        grid-template-columns: 2fr 1fr !important;
      }

Example 21 - Size of group buttons

card_mod:
  style:
    sonos-groups$: |
      mwc-list {
        width: 10rem;
      }

Example 22 - Font size for everything

card_mod:
  style: |
      div {
        font-size: 22px !important;
      }

Example 23 - Increase entity font

card_mod:
  style:
    sonos-player$ sonos-player-header$: |
      .entity {
        font-size: 12px !important;
      }

Example 24 - Hide the select all/none buttons at the top of the groupings page

card_mod:
  style:
    sonos-grouping$: |
      sonos-grouping-button {            
        display: none;
      }  

Example 25 - reduce min-width of the card

widthPercentage: 30
card_mod:
  style:
    .: |
      ha-card {            
        min-width: 10rem !important;
      }  
14 Likes

I plugged this in and my SONOS system had a complete meltdown 3 times. I had to stop my host to try to force control back of my system each time. I don’t know why but on this last time, I got a stable experience but I also intentionally didn’t push it to its limit.

So with that, I have some notes:
The first problem I encountered was some sort of scanning. When I selected a frequently used playlist, it just kept changing tracks quickly. To the point where no music was being played and I couldn’t regain control. While struggling to regain control through a HA reboot in the SONOS app, as fast I could clear out the song queue for a device, it was putting it right back. It was the correct music queue, it just kept forcing it in again and again.

The second problem I encountered was grouping. I have 9 rooms of SONOS and that’s kindof a lot even on a good day. Trying a select all players made the player and my sonos have a meltdown. Joining one at a time is slow but does work. Having all of them joined, while trying to regain control of my sonos system with a HA reboot, I kept trying to ungroup the rooms in the sonos app and it kept regrouping them.

The last time, I queued up a station instead from SONOS, then from the lovelace card pressed play. playback was beautiful. I added one room at a time to it, patiently waiting between and it worked (although grouping is slow). I know even running grouping automations can be slow so this might just be the cost of doing business.

I was afraid to push it any further after I got one successful playback. I can pick up additional testing later but trying to kill/regrain sonos control is a wild and time consuming process and I’ve had enough for tonight.

This is better than any Sonos card I’ve touched so far but I think there’s still some unexplained behavior. There’s definitely something that it persistently isn’t liking but I’ll need to play with it more to articulate it.

1 Like

Thanks for taking the time to give this feedback!

I very much agree that there is something strange going on here. I see similar behaviour, but not as bad as you state it. Many times it works fine for me, but every now and then it becomes unstable.

As I wrote above, the code is forked from another repo and the parts we are talking about here have not been built with me.

Looking at the code for these parts, it looks straight forward (and correct), so it would be really interesting to understand what is wrong with it.
I hope I can find time to investigate it. Meanwhile, please let me know if you have any ideas on how to improve it!

@Sergeantpup I did some debugging last night, and could notice that many duplicate calls were being made to Home Assistant for a single click in the card.
Finally I found that the original author had used the updated() method to add event handlers, instead of using the @click functionality.
As soon as I changed the code to instead use @click everywhere, it started behaving as expected.

Could you please have another go at this? The new release should be available in HACS.
On github you can see it here: https://github.com/johanfrick/custom-sonos-card/releases/tag/v1.2.0

This is absolutely hilarious. Thank you for this great laugh this morning. Yes, I will try it again and see what I get!

1 Like

I plugged it in and it works beautifully. The grouping timing has even improved immensely (I’m sure from not fighting itself anymore). Ungroup all is a nice button, wish the sonos app had that.

I WAS a little concerned when I saw a button available to add a device that’s already part of the group and I was terrified to press it but I pressed it and nothing happened. I’m ok with nothing happening, I was just afraid of bad stuff happening. My only note would be to not display the main as an addable room if it’s already part of the group but that’s purely cosmetic at this point (it doesn’t alter functionality).

Somebody suggested this card to me recently (I’m not sure if it was you) before the fork and I know it wasn’t an acceptable solution at that time. THIS is now an acceptable replacement for what I’ve been using:


I will likely keep the sonos card now permanently

One weird question that doesn’t really have anything to do with the card but there’s not an MDI icon for SONOS? Even Hubitat had SONOS icons. I saw amazon, google, all the social medias but the only icon I could find is the lame casting icon. It just seemed like something that was ubiquitous enough to be in everybodys icon db. Do you know of any magical way I can get a sonos icon?

Thanks for testing it, and I’ve totally missed that bug about current master being displayed under grouping.

That is now fixed: https://github.com/johanfrick/custom-sonos-card/releases/tag/v1.2.2

For icons, you can use this one in HACS which has Sonos (and lot’s of other brands): https://github.com/elax46/custom-brand-icons#sonos-device

Well you’ve certainly fulfilled my wildest fantasies with icons today. Thank you for introducing me to that resource. I have already configured all my device icons.

Thanks for the update to the code. I plugged it in and it definitely handles the removal of the master smoothly. Just as fast as you can click a primary, it removes the appropriate entity from the grouping list. The only weird thing I saw was a truncating thing that happens sometimes based on room name length. This is probably based on a zillion factors like screen size, resolution, dashboard layout but it is just a cosmetic quirk I noticed. Maybe you can force the group/ungroup buttons to their own line permanently?


Functionally, I think you hit the jackpot.

I cannot seem to get this working. Followed the instructions on HACS, used the example yaml for card config, with my entities in it, reduced to only the required fields, and no luck. Any pointers?

Is it just not displaying? Because I get that sometimes. Or are you getting an error in your custom card?

here is my exact card:

type: custom:custom-sonos-card
name: ''
groupsTitle: ''
groupingTitle: ''
favoritesTitle: ''
headerImage: ''
shuffleFavorites: false
noMediaText: No media selected
allVolumesText: All volumes
entities:
  - media_player.bedroom_sonos
  - media_player.bedroom_2_sonos
  - media_player.deck_sonos
  - media_player.dining_room_sonos
  - media_player.garage_sonos
  - media_player.living_room_sonos
  - media_player.media_room_sonos
  - media_player.office_sonos
  - media_player.stairway_sonos

Love the card, I dont know if I’m doing something wrong, or need to wrap the card in another card like css mod, but mine just does not seem to display like the images I see. The favorites and media player column is too condensed.

Here is my card

type: custom:custom-sonos-card
name: Sonos Card
groupsTitle: Devices
groupingTitle: ''
favoritesTitle: ' Favorites'
headerImage: ''
shuffleFavorites: false
noMediaText: No media selected
allVolumesText: All volumes
entities:
  - media_player.house_speakers_sonos
  - media_player.great_room_sonos
  - media_player.living_room_sonos
1 Like

Glad you like it!
To make it wider, please use panel mode. Read more here Views - Home Assistant

I’m really liking the functionality in this card, thanks for making it!

Is it/will it be “themable”? I don’t do much with my HA front-end, so if I’m just missing something obvious, be gentle :wink:

Thanks again!

1 Like

Theming support added with v2.0.0. Read more here: https://github.com/johanfrick/custom-sonos-card#theme-variables

Last night it was nothing, this morning it’s an error…

Please try again with v2.0.1

1 Like

I was too afraid to ask for something other than white backgrounds lol. I’m happy with what I got but to tone down all the white on the screen at night would be great!

Yes, now you can control it yourself, since theming support has been added.

Thanks working now!

1 Like

I am over the moon thrilled with this

What do you think about adding a clear playlist button? Doesn’t have to be for all but a way to clear out the playlist of any room

1 Like