SpotifyPlus Card Dashboard

Not sure what I’m doing wrong but when I try and switch devices I get this error:
image
I created the spotifyplus_tokens.json file with the python script and uplaoded it:

I am using old Sonos devices if that matters? I’ve also noticed the Queue is always empty and when I click to add an item to the queue it does nothing.

@Helheim
The invalid grant portion of the message indicates that your token could not be refreshed after the expiration period (usually about an hour). This can happen if the Spotify servers failed to respond in a timely manner (likely), or if you are sharing a token among multiple Spotify Accounts.

Are you just using a single Spotify account with SpotifyPlus? Or did you setup multiple Spotify accounts? If you are only using one account, and if this has never happened before, then I would chalk it up to a Spotify server problem. If not, then we will need to run some traces if it keeps happening. In either case, you will need to regenerate the token with the python script and re-upload to the spotifyplus_tokens.json file.

The old Sonos should not matter; but for peace of mind, what is the model # of the Sonos?

As for the queue always being empty, that is a known limitation of using Sonos devices with SpotifyPlus. Since they are considered “restricted” devices by the Spotify Web API, some functionality is disabled. In the case of Sonos, the Sonos local queue is used for the play queue.

I setup multiple Spotify accounts so there are two in my spotifyplus_tokens.json and I have two setup in the integration. It’s a Connect:Amp (ZP120).

@Helheim

Try executing the following from Developer Tools \ Actions (yaml mode). This will list what application credentials are mapped to your individual SpotifyPlus media player instances.

action: spotifyplus.list_application_credential_mappings
data:
  filter_domain: spotifyplus
  filter_credentials_only: true
  list_domain_entities: false

Example Output:

result: |
  **Domain: spotifyplus**
    Application Credentials:
      - ID: `spotifyplus_eab07793bc ...`, Client ID: `eab07793bc ...`, Name: `Todd L Premium`
        - Entity ID: `media_player.spotifyplus_todd_l`, Name: `SpotifyPlus Todd L`, Unique ID: `31l77y2 ..._spotifyplus`
      - ID: `spotifyplus_fd8d567505e74...`, Client ID: `fd8d567505e74...`, Name: `Todd L Free`
        - Entity ID: `media_player.spotifyplus_todd_l_free`, Name: `SpotifyPlus Todd L Free`, Unique ID: `31dutb2..._spotifyplus`

Make sure that the Unique ID: values are NOT the same (e.g. using the same account). Also make sure the ID: values start with spotifyplus_....

Another thing to verify is that you authenticated to Spotify using the correct account for each Application Credential. If you authenticated BOTH of your Application Credentials using the same username / passworde (or more commonly, cached login credentials) then this error will occur.

How exactly do you resize the card?

Here is the default view on my phone:

I’ve tried changing the width in the card, but it always looks like this, regardless of the rem size:

(example of Rem Size 2)

@jmm003
Renders the card with a width of 100%.

width: fill

@thlucas

Does not fix the issue. Fill renders the card in the same width as the first photo I shared (too wide).

EDIT: Fixed. Capitalization of “fill” caused the issue.

Does this look right?


What type of dashboard do you have the card in? You will need to set it to “Panel (single card)” view. I would suggest creating 2 different dashboards - 1 for mobile use, and 1 for desktop use.

You can also change control icon sizing, as well as player header title sizing.

type: custom:spotifyplus-card
width: fill
height: fill
playerControlsIconSize: 2.6rem
footerIconSize: 2rem
playerHeaderTitle1FontSize: 1.2rem
playerHeaderTitle2FontSize: 1.2rem
playerHeaderTitle3FontSize: 1.2rem
...

Here’s mine on an iPhone 16 Pro Max:

The error was mine. I initially capitalized “fill.” Lower case fixed the issue. Renders perfectly now.

Great card. Thanks for your hard work on this!

1 Like

@Helheim
The 2 tokens appear to be good.

The App Credentials look good, though I could not verify that the ID: "spotifyplus_..." values were different between the 2 entries. You just need to make sure that the unique id value (e.g. 6d0t4) corresponds to that Spotify Developer App Client ID value. The easy way to do that is to logon to Spotify Developer Dashboard using your 6d0t4 username, click on your Home Assistant Spotify Plus Integration application, and verify the Client ID value.

Then repeat that process for the phablifestyle user and it’s client id value.

Hi @thlucas,

Brilliant add-on, this is the holy grail for me and have been searching for something like this for the past year, only just found this for some reason. Love it all, I’ve a couple of questions (I’ve read through this topic but cannot see my answer).

  1. Is there a way, when selecting an album to play, to view the playlist of that album as well? Or is that not an API offered by Spotify?

  2. When searching for an artist, when I click on the artist it starts playing music by that artist. Is it possible to instead view a list of albums which I can then choose to play?

Many thanks for this add-on, it’s great!

@Jinkler
Thanks for the kind words.

Answers to your questions:

  1. If you “click and hold” (or long press / click) the album tile in the search results, it will then display a dialog of the tracks in that album.

  1. If you “click and hold” (or long press / click) the artist tile in the search results, it will then display a bio / information details for that artist. There is also a “…” button that will display a context menu of commands for that artist. It allows you to display artist top tracks, their albums, compilations, singles, related artists, etc. You can also search for playlists that contain that artist, tracks by that artist, etc.

1 Like

Awesome, thanks @thlucas! Working as you described!

Would you be able to help me with another issue that’s arisen? I’m sure it’s something I’ve done but for the life of me I can’t see what. When I now play a song it just keeps repeating itself (Sonos S1 speaker if it makes any difference). The repeat button isn’t selected. In fact, when I do press it to check, it won’t stay selected (blue in colour), it reverts back to white. Any ideas what else to check? Thanks!

PS - how can I buy you a beer?

1 Like

@Jinkler
If you select a single track to play, then it will probably keep repeating itself because it’s the only thing in the queue. The Sonos device probably resets the repeat option, as there is only 1 track. To confirm that, you can select a playlist (with more than 1 item) for play; it should then honor the selected repeat feature.

Sonos is tricky, because it’s considered a “restricted device” and cannot be controlled by the Spotify Web API. It’s a limitation of the Spotify Web API, in my opinion. To get around this, the SpotifyPlus integration uses the Sonos Controller (SoCo) API to control the device. It also uses the Sonos local queue to play Spotify content.

Hope that explains it well enough.

You can use the Buy Me A Coffee site to donate to the project if you like. Anything is appreciated, as I use the donations to pay for my Spotify membership.

I’m selecting an album to play. When I first installed this a few days ago, it worked. I could select and album and it’d play through it. Now though, it only plays the first track of an album on repeat. I’ve just checked with a random spotify playlist, and yes, it only plays the first song on repeat. I’ve messed something up here somewhere…

@Jinkler
I would try starting the Sonos App and see what it indicates for the repeat status. I know Sonos does some weird things with combining the repeat and shuffle settings when setting either shuffle or repeat. I wonder if they pushed an update that is maybe added another status or something?

It could also be something specific to the Sonos S1 model that you have. I know my Sonos IKEA Symfonisk seems to be working ok with repeat / shuffle functions.

@thlucas I just wanted you to know how much I appreciate your work on this. Finally, I’m able to use Spotify through Home Assistant the way I’ve always wanted.

You are a hero among men!

1 Like

Agree!

Very nice update that includes visualisation of current playing device with custom image.

1 Like