core: media_player.spotify_X allows media browsing but its integration (spotify) does not

The problem

Spotify media library does not work at all. It used to work, but I lost track which version was the last version confirmed working for me. Apparently the integration does not support media browsing according to the logs.

Environment

  • Home Assistant Core release with the issue: 0.116.4
  • Last working Home Assistant Core release (if known): -
  • Operating environment (OS/Container/Supervised/Core): Ubuntu 18.04.5 LTS, Home Assistant Supervised, hassio, docker
  • Integration causing this issue: Spotify
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/spotify

Problem-relevant configuration.yaml


Traceback/Error logs

2020-10-19 10:02:36 ERROR (MainThread) [homeassistant.components.media_player] media_player.spotify_X allows media browsing but its integration (spotify) does not

Additional information

When I press the media browsing button, the frontend gets stuck and the only way to get it to work is by refreshing the page.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 18 (14 by maintainers)

Most upvoted comments

I had a more detailed look at the coding. This exception in the Spotify context will appear if the “scopes” of the session token are not matching what the integration expects. https://github.com/home-assistant/core/blob/bfc3d3be764123adb147d39d73b87c2e9e9d9673/homeassistant/components/spotify/media_player.py#L221

Those scope values are stored in the HA core.config_entries. So removing and re-adding the integration might work (hoping that then it pulls the correct scope attributes). Or as a test manually setting the values in the config file:

"scope": "playlist-read-private playlist-read-collaborative user-modify-playback-state user-library-read user-follow-read user-read-playback-state user-read-recently-played user-read-playback-position user-read-private user-top-read"

There is one extra scope returned from the API that is not in the list. The 2 conditions are not the same hence the check is failing. The one check if the list is exactly the same while the other one checks if its a superset.

@frenck Is there a specific reason why the 2 conditionals are diff? https://github.com/home-assistant/core/blob/5a7e4b4dae8d291a53805b646a725202ffb8000c/homeassistant/components/spotify/__init__.py#L80

vs

https://github.com/home-assistant/core/blob/dev/homeassistant/components/spotify/media_player.py#L221

If not, then ill change the PR to make them the same 😊

Screenshot 2020-11-08 at 20 54 17

For reference. Today I’m getting the same error. Even after re-adding it before like @spacegaier suggested. So it might be a deeper issue 🤔.

I would love to do it! 😊

I’m having the same problem (both via cards and Media Browser link in the sidebar). Nothing additional in the logs beyond what’s been mentioned already by OGKevin.

Strangely, it was working a few days ago on 0.116 and stopped out of the blue. I’ve since updated to 0.117.2 and still having the same issue. I’d put it down to an API change if it weren’t for the fact OGKevin’s stopped almost a fortnight before mine did.