Not sure what I’m doing wrong but when I try and switch devices I get this error:
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.
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.
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.
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
...
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.
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).
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?
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?
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.
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!
@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.