SpotifyPlus Integration

I’ve been doing this, my issue is the player never goes to idle after something was played, at least on an Alexa.
It stays on “Paused” but after some time if you press play it wont play, you have to load a new “session” by triggering music via alexa or spotify.
The official integration, when this happens, it goes to Idle

Other than that, seems to be working fine

FYI - just released a new version of the SpotifyPlus integration

Be sure to check out the SpotifyPlus Card Dashboard as well.

[ 1.0.68 ] - 2024/12/06

  • Updated service player_transfer_playback to resume play if play=True and force_activate_device=True. If forcefully activating a device, then we need to resume play manually if play=True was specified; this is due to the device losing its current status since it was being forcefully activated (e.g. disconnected and reconnected).
  • Updated underlying spotifywebapiPython package requirement to version 1.0.123.
1 Like

@z3p337
I just pushed out SpotifyPlus v1.0.68 release. Can you give the new release a try with the Denon HEOS error that you reported?

I added some logic in the underlying spotifywebapiPython package GetSpotifyConnectDevice method that first checks to see if the specified device is already in the device list. If found, then it will not disconnect / reconnect the device. Prior to this, it would always disconnect / reconnect the device. My thought there is that if the device is already in the list, then it should be connected and ready for immediate use.

Please let me know.

UPDATE - 2024/12/09 - The guy that ran the traces for me reports that the v1.0.68 changes fixed his Connection refused issues for the Denon AVR that he has.

@NathanCu
I just pushed out SpotifyPlus v1.0.68 release. Can you give the new release a try with the Denon AVR / HEOS errors that we have been corresponding on?

I added some logic in the underlying spotifywebapiPython package GetSpotifyConnectDevice method that first checks to see if the specified device is already in the device list. If found, then it will not disconnect / reconnect the device. Prior to this, it would always disconnect / reconnect the device. My thought there is that if the device is already in the list, then it should be connected and ready for immediate use.

Please let me know, and thanks for your help.

BTW, another guy supplied some traces for me (for Denon AVR anyway), so I no longer need the traces we talked about.

UPDATE - 2024/12/09 - The guy that ran the traces for me reports that the v1.0.68 changes fixed his Connection refused issues for the Denon AVR that he has.

Hi, great job for this integration:) i just discovered this… but i have question: after recent API changes there is no more option to fetch than 10 fabourite Playlist? i noticed thato on official spotify integration alsonthere is only 10 fetched…

@mackbeth
Can you be more specific as to the specific SpotifyPlus service that you are calling which only returns 10 items?

  • get_playlist_favorites
  • get_playlists_for_user

The recent API changes did not limit (AFAIK) the number of playlists that can be returned for the above services. You might also check the limit and limit_total values on your service call to ensure you are not limiting the results to 10 items.

I have 12 playlists that I have as favorites, and it returned all 12 of them (using SpotifyPlus Card, which uses SpotifyPlus get_playlist_favorites service):

Hi,

Just strat play with this integration, I;m not even sure, If I follow all steps and integration is installed properly :slight_smile: to be honest, jsust fast during work day installation to check what it is :slight_smile:
I just set up basic card:
image

Onestly I didin;t read whole instruction and in integration configuration probably I di not put proper things…

I manage just to play/ pause my current spotify song… Hmm…
I noticed in log:

Maybe I delete whole integration and try again setup step by step. Ouath I had previous as I used Spotcast

Also I noticed, that from your card, I;m able only to play pause. But in spotify Plus service, I;m able to browse media, play playlist (stil only 10 is fetched from my loong list of favourite…

and las onow I read whole manual:

Ok, so now I have to independent application, spotify and spotify plus now have different application credential. I setup integration. It uses proper application credential. I create basic card.
And card also not work at all. Even if it fetch as you see above 10 my favorite playlist, clicking on them does nothing… Only play/ pause works as expected…

Ah… and connected devices in my case are: My mobile phone when I just play something (it is visible) Android Tv, Web Browser when I log into Spotify Web app…

None of them work… I suspect, that there is something with authorisation still…
Even If I link app with integration, I have proper redirect urls (i put many in app just in case)
image

What I surprise for me… card not work at all, nothing… I use HA 2024.12 Core version, I have Spotcast integration, I have Spotify native Integration…
My plan I premium Duo,
Btw… thanks for fast repsonse. I’m IT Test engineer, so you may add a little more details how it works ,I should understand or how to debug better.

I play with service, and when I tried get playlists:

I played with this… Call return proper number of my fav playlist (52) but uiin response I got json only for 10, exactly the same as displayed in card.

BTW… official Spotify integration, when I browse media returns exactly same result - only 10 playlist… :slight_smile:

1 Like

@mackbeth
Your SpotifyPlus configuration options look correct; the fact that you are returning 10 playlist favorites results tells me the authentication and callback id is setup correctly.

The Failed to perform action spotifyplus_get_featured_playlists. SAM1010E ... error is expected, due to Spotify Developer team deprecating that feature. For more information on that, check out the SpotifyPlus Card Troubleshooting Guide wiki page; there were a few functions that Spotify Developers suddenly (and without warning) removed from their Spotify Web API.

If you want to get YOUR favorite playlists, then use the SpotifyPlus Get Favorite Playlists service. It appears (based on your screen capture) that you are not specifying a Limit Total argument, which causes the service to use a default value of 10. Try this (adjust the entity_id if necessary):

service: spotifyplus.get_playlist_favorites
data:
  entity_id: media_player.spotifyplus_mackbeth1
  limit_total: 100

Also, you should only need the https://my.home-assistant.io/redirect/oauth entry in the Spotify Developer App Redirect URIs settings, but it will work the way you have it. You will get better performance if you just have the one https://my.home-assistant.io/redirect/oauth redirect URI.

Try the above YAML, and let me know if that works or not.

Hmm…

Checked… and :slight_smile:

Still only 10 results in returned json.

To be honest, functionality which I search in HA for Spotify is to card with my favorite playlist, browse Spotify playlist, and play Spotify with selected playlist from automation :slight_smile:

You card gives all Spotify functionalities, evens search songs, play any song from any plalist… so it is what I was searching in last 2 years :smiley:

Hi!

How can i remove the numbers and percentes from the volume slider? I need only the sider.

thx

What I noticed… on PC I tested card on Chrome and Brave and edge browser… nothing happened after click on card… but on mobile phone, also Chrome or Edge it works… :slight_smile:

@Grandmasterseven
There is currently no way to do that. Please submit a feature request on the GitHub page and I should be able to add the ability though.

This will be implemented in the next release …
Added playerVolumeControlsHideLevels config option to the player volume controls editor. This will hide volume level numbers and percentages in the volume controls area of the Player section form. Volume slider control is not affected by this setting.

@mackbeth
To confirm, the SpotifyPlus get_playlist_favorites service returns more than 10 results when it is called on your mobile phone browser?

But the service only returns 10 entries when called on your desktop browser?

If that is the case, then it sounds like the problem might be a browser caching issue. Try clearing your cache on the desktop browser.

@thlucas Nope :slight_smile:
I tried same service call from my mobile:)
Is anything in logs, what I can check? I enabled debug…

5mins later…

Cleared cache on all browsers, and same result:

image

So to summary:

  • call service on desktop browser (Chrome, Brave Edge) - 52 items, but in yaml only 10 entry
    • call service on mobile browser (Chrome, Brave Edge) - 52 items, but in yaml only 10 entry
  • call service on HA app - 52 items, but in yaml only 10 entry

SpotifyPlus Card on desktop browser doesnt react to anything almost excpet play, pause. When I click on any album, nothing happen

Spotify Cards on mobile browser react - able to play any playlist (1 of those 10 in my favourite, etc.)

For favorite albums card display correct number of them, also service returns correct data:

For track - only 50 items

image

Can it be problem with parsing paginated results?
I set limit per page to 10… and only 10 results…

image

As you see, the next field contains “null” - so look like next page with result is not created…

@mackbeth
What do you get when you execute the Spotify Web API Get Current Users Playlists endpoint? Go to the link above, enter limit 50 and 0 offset, and click Try It. What do you see for the "total": value in the response?

In my example below, I have 17 playlists in my favorites:

Hmm… intresting :slight_smile: same result :slight_smile: Only 10 playlist from my favourites

1 Like

@mackbeth
OK, I think I know what’s going on. The Spotify Web API will only return user-defined playlists in the results. It will not return any Spotify Algorithmic playlists (e.g. “Daily Mix 1”, “Discover Weekly”, and other “Made For You” playlists). It will also not return playlist folders.

Can you compare some of the items in your online list that are missing from the SpotifyPlus service results to see if they are playlist folders or “Made For You” content? If all of them are like that, then it explains it (Spotify Web API will not return them).

If the missing items are truly playlists, can you provide the Spotify Playlist URI (e.g. spotify:playlist:xxxxxx) value? or the url link to the spotify.com page of the playlist? It could be something to do with country / market limitations on what can be returned via the API as well. For example, if content items in the playlist are for US-based consumers only, it may not return it since you have a PL country / market designation.

Ok, here is list by creator:)

I added one more list from some user, na voile - 11 results:)
image

You are right… only non by- Spotify created are returned… i thought that all of them will be… :slight_smile: - I think it is worth to mention on your integration documentation :slight_smile: So there is no chance to display my favorited lists… which is main fucntionality which I’m searching :slight_smile:
So API doesn’t return any Spotify created things… I noticed this also i.e. when I search some Spotify list… This was change by Spotify recently, right? So sad to me, as user who pay for this content created by spotife… This change have no sense to me at alll…

Before API changes I use Fondberg Spotify Lovelace Playlist card… but… card died recently after API changes…

But what about my favourite tracks? Is any chance to got all of my 825 track on card? :slight_smile:

Btw… thanks for help and a lot of patient to me:)

1 Like

But there is trick…

I noticed, that via User Preset I can add Spotify playlist…

Also noticed, that daily mix and other generated for user list have fixed uri … I check URI saved 1 year ago, when I put it to browser or to user preset, it will play current Daily mix list…

So now script to get from web app URI to all favorite playlist URi’s, and copy them to json User Preset file:) - an way tro execute to sync :slight_smile:
Unfortunately I don;t have any coding skills (especially web - never) now after years in corpo as Test Architect … :frowning:

@mackbeth
I updated the SpotifyPlus Get Playlist Favorites documentation with our findings. Thanks for bringing that to my attention; the Spotify Development team removed that functionality without warning, and I had not had time to revise the docs until now.

I currently have a limit of 200 set for the maximum number of items to return. I can make this number configurable for each section type (e.g. tracks, albums, artists, playlists, shows, audiobooks, episodes), which will be available in the next release of the SpotifyPlus Card. Just keep in mind that the larger the number you allow, the slower the response will be.

As for User Presets, you are correct - you can define presets in the JSON file (or in the card configuration itself via the userPresets option). This includes the various Spotify “Made For You” content items, as their playlist ID’s do not change. Check out the How do I find the Spotify “Daily Mix n” playlist id wiki FAQ page for instructions on how to find the playlist URI value for a Spotify playlist. You can also use the “Copy Playlist Preset Info to Clipboard” action item from the Search Playlists details (see screen capture below) to format the userPreset config entry for you. Note you will have to modify the output a little for the userPreset.json format. I am going to add another action item to “Copy Playlist Preset JSON to Clipboard”, which will format the JSON for you; just haven’t had the time to do that yet.

image

Hope it helps!