I am using the same plug-in, but somehow i still cannot play playlist. But can get album to play. However, i cannot get a “random” alum to play. It is always the same album. (the first one). Any idea where i did wrong?
randomsqueeze:
alias: "Morning music"
sequence:
#a bash script that turns on shuffle-by-song
- service: shell_command.squeeze_shuffle_songs
- service: media_player.play_media
data:
#change this to match your player
entity_id: media_player.lms_google_home
media_content_type: PLAYLIST
data_template:
#add as many playlist or album IDs as you like
media_content_id: >
{{ ["spotify:album:5dN7F9DV0Qg1XRdIgW8rke", "spotify:album:7hPq9fDWwXPo1tT0oi3XcM", "spotify:album:2rQ135imvelvp89D8eEZOi", "spotify:album:7xl50xr9NDkd3i2kBbzsNZ", "spotify:album:0vNPAhooQJWujYOZrsOJw8", "spotify:album:2MKNnI6Ttt2kF8kHWWG930", "spotify:album:2MKNnI6Ttt2kF8kHWWG930"] | random}}
This is related to an issue with the random filter not working. If you restart HASS, you’ll get a different random position initially, then it’ll keep using that position until HASS restarts. Very annoying - add your voice to the conversation in hopes that it gets fixed soon:
But you should be able to get a playlist to play if you can get an album to play by its URI.
Playlist URIs look like: spotify:user:ih8gates:playlist:32kolpL0K7jto6GQZE2skl
Get the URI for one of your own playlists by right-clicking in the Spotify app and choose “Copy Spotify URI”
Got it! Will go that discussion later.
About the URI, i actually thought the same. However, no matter i tried my own playlist, or the Spotify playlist, they all won’t work.
But if you do the same exact thing (using the dev tool) and put an album URI in in-place of the playlist URI, it works fine?
Sounds like maybe it’s an issue with the protocol handler. If I look at the settings for mine (in LMS), the version of the Libspotify API I have is: 12.1.51.g86c92b43 Release win32
I would hope that running on Linux shouldn’t be the problem. Looks like you’ve got a newer revision of the API than I have. So I don’t expect that’s the issue.
Let’s take a look at the LMS server directly and see if the problem’s there. Create a shell script on your PI with this as the contents:
You’ll need to replace the “bc:5f:f4:e9:44:4a” part with the MAC of your player as seen by LMS. You can find this by opening “settings” on your LMS interface, then go to the player tab. There should be a drop-down with a list of players. Choose one and the mac will display under “player info”.
Then change the IP address in that last line to match the IP of your LMS server. You can experiment with different Spotify URIs in that setting that starts with “spotify:user…”
run the script (“bash scriptname.sh”) and see what happens.
Albums should work - curious to see if playlists do.
Be sure that you’re using the Triode protocol handler, not the Triode Spotify plugin. If you still have the old Spotify plugin, try disabling it. I think the preferred setup is to use the official Spotify plugin (from Logitech), with Triode’s protocol handler.
I have Spotify (v1.0) from Logitech and Spotify Protocol Handler (v1.1.1) from Triode. Think that should be it. Am trying to find the relative discussion about the playlist issues. There seems to be quite a few, but not really exactly my case. Probably i will need to spend some time reading through the thread.
Your comment of playing the Spotify playlists from mysqueezebox.com helped!
I went to the website and found that i did not log in my Spotify account on the web interface! I logged in there and the magic happened! The playlists just started playing!
Although i have no idea why other stuff (albums/ tracks) could work… but anyway now it works perfectly. Thanks for your help in past few weeks!!!
For people coming back to this. As of April 2017, the random filter has been broken in HA. You’ll get a random playlist the first time this runs, but subsequent commands load the same randomly-chosen playlist. Reboot HA and you’ll get a new random choice, but you’re stuck with that choice till you reboot.