Type in your question below and we'll check to see what answers we can find...
Loading article...
Submitting...
If you couldn't find any answers in the previous step then we need to post your question in the community and wait for someone to respond. You'll be notified when that happens.
Simply add some detail to your question and refine the title if needed, choose the relevant category, then post.
Before we can post your question we need you to quickly make an account (or sign in if you already have one).
Don't worry - it's quick and painless! Just click below, and once you're logged in we'll bring you right back here and post your question. We'll remember what you've already typed in so you won't have to do it again.
Please see below the most popular frequently asked questions.
Loading article...
Loading faqs...
Please see below the current ongoing issues which are under investigation.
Loading issue...
Loading ongoing issues...
Hi there,
I am dealing with the shuffle function of Spotify.
As Spotify cannot differentiate between music and audiobook by itself I built an automation in Home Assistant with the Spotify API to turn on/off the shuffle state depending on whats playing.
That is working good when you are only listening to a couple of artists.
Like me I am listening to the german audiobook "TKKG" for example.
So I am telling the API to turn shuffle off if the media_artist is TKKG.
But when I a want to listen to another audiobook I have to add the media_artist manually to my automation.
There is an attribute from the API called "media_content_type" but this is always "music" to I cannot differentiate between normal music and audiobooks.
Unfortunately I cannot identify an audiobook precisely to turn off shuffle.
Manually turn on/off shuffle its not an option because I am switching too often between the two media_content_type.
Can you help here?
Thank you!
Greets
Daniel
Hi Daniel - Todd Lucas here, author of the SpotifyPlus integration for Home Assistant.
Take a look at the custom SpotifyPlus integration (replaces HA Spotify). It has a large number of provided services that support almost all Spotify Web API functions. It's "media_content_type" also contains the spotify uri value (see below for an audiobook example).
source_list:
- Bose-ST10-1
- Bose-ST300
- Web Player (Chrome)
spotifyplus_device_id: 30fbc80e35598f3c242f2120413c943dfd9715fe
spotifyplus_device_name: Bose-ST10-1
icon: mdi:spotify
friendly_name: SpotifyPlus Todd L
supported_features: 2543551
volume_level: 0.36
is_volume_muted: false
media_content_id: spotify:episode:4M3EPiw6yGVGhBDRZBB2eC
media_content_type: podcast
media_duration: 2967.27
media_position: 379.397
media_position_updated_at: "2024-06-14T19:54:19.088463+00:00"
media_title: Chapter 3
media_artist: Penguin Random House
media_album_name: The Elfstones of Shannara
source: Bose-ST10-1
shuffle: false
repeat: "off"
entity_picture: >-
/api/media_player_proxy/media_player.spotifyplus_todd_l?token=6ba35bcd185b53961d0c6c703c514d0dcf4fdf8c57aa34f4bc60265cdfbcc530&cache=dae4af20915c34c0
Hope it helps!
Hi Todd,
first of all thank you for getting me known of that integration. I installed and tested it but I get this output for the german TKKG example:
source_list: DeepThought, Denon AVR-X3300W, Volumio, Überall
volume_level: 1
is_volume_muted: false
media_content_id: spotify:track:1jiWGbUkEuekRkavq1GsOV
media_content_type: music
media_duration: 35.44
media_position: 7.112
media_position_updated_at: 2024-06-16T21:17:15.664420+00:00
media_title: TKKG Titelsong
media_artist: TKKG
media_album_name: Folge 232: Drohnenaugen in der Nacht
media_track: 2
source: DeepThought
shuffle: false
repeat: off
spotifyplus_device_id: e0cce38437c305c898bf83b2b4cb8023c4fe17c7
spotifyplus_device_name: DeepThought
entity_picture: /api/media_player_proxy/media_player.spotifyplus_xxx?token=cf463a899335b18016881904db772f73e4faf4a4802822b82f9c9ad0dc5cf12e&cache=3567b5f43e17313e
icon: mdi:spotify
friendly_name: SpotifyPlus
supported_features: 2543551I am not sure but I think there is a difference between podcast and music given by the API already but Spotify do not provide the difference between music, podcast and audiobook so that I cannot identify them. As you can see in my entity attribute also the media_content_id provides "spotify:track" instead of "spotify:episode".
Greets
Daniel
Hi Daniel.
I believe the issue here is that the "Folge 232: Drohnenaugen in der Nacht" title is recorded as an "album" that has "tracks" to separate it's episode content. When you look at the "Folge 232: Drohnenaugen in der Nacht" title in the spotify web player, it's URI value is "spotify:album:2H6V3f2vVJgDmXndKZ3t9G" - this denotes an album (not an audiobook). By default, any content playing for an album context would be derived as a "track" for the media_content_type value in HA.
In comparison, here's an example of an audiobook ("DragonSong", URI=spotify:show:3PFyizE2tGCSRLusl2Qizf). Notice that its media_content_type is "podcast" for the currently playing content.
...
media_content_id: spotify:episode:6u1UhjcauKDyL3CAxwT3mI
media_content_type: podcast
media_title: Introduction
media_artist: Recorded Books
media_album_name: Dragonsong
media_context_content_id: spotify:show:3PFyizE2tGCSRLusl2QizfI would think it would be "audiobook", since I found it when searching for audio books, but I believe Spotify identifies audiobooks as "shows" instead of "audiobook".
I guess it's up to the content provider on how they provide their media to Spotify for consumption.
With that said, I can modify the SpotifyPlus integration to return a new state attribute called "media_context_content_id" that would contain the context URI ("spotify:album:2H6V3f2vVJgDmXndKZ3t9G" in the case of "Folge 232: Drohnenaugen in der Nacht". This is what it would like like:
media_content_id: spotify:track:3uueCWMR6rQf9vxlTpT5UN
media_content_type: music
media_title: 232 - Drohnenaugen in der Nacht - Teil 01
media_artist: TKKG
media_album_name: "Folge 232: Drohnenaugen in der Nacht"
media_context_content_id: spotify:album:2H6V3f2vVJgDmXndKZ3t9G
Hi Todd,
that's the "issue" I reported. They don't handle audiobooks as audiobooks. That's the main problem which you cannot solve also I think.
The content-type from the content provide has to be correct.
Greets
Daniel
Hey there you, Yeah, you! 😁 Welcome - we're glad you joined the Spotify Community! While you here, let's have a fun game and get…