I’m using Spotify for quite asome time now, I’ve pressed the -icon on all the songs I like. Spotify then puts all these songs in a playlist called “Liked songs”. This playlist isn’t public and doen’t have an URI to call via the spotify.play_playlist-service. Apperently there’s an API call for playing the songs in this playlist. It would be great to have a service call (or some other possibility) to trigger playing this playlist from HA. Yes, there are workarounds, but I thinhk it would be great to have the possibility to trigger playing this playlist. Feedback is more than welcome.
It will be nice for all players, very often in other players this function does not work the way the user wants. Also, it would be great for HA to collect its own playlist, and take into account that it plays more often.
Thank you @robin.thoni
I’ve tried a half dozen different ways to play Spotify Liked Songs over the last year. From using Pushcut + iOS Shortcuts to playing a voice command so that Google mini or Alexa start it. This is so much better, thanks!
I see “Liked Songs” playlist is currently available as “Tracks” in media selection of the default card, but it is missing the option to play them all, like the one available in “Playlists”. Playback stops after the selected song is over of course.
I’m still struggling though to get the “play liked songs” working.
The SpotifyPlus integration is correctly installed. I have a Devialet at home. I added the Turn On script (I’m not entirely sure what it does and if it’s needed ^^):
alias: Turn-on SpotifyPlus
sequence:
- service: spotifyplus.player_transfer_playback
data:
entity_id: media_player.spotifyplus_max
device_id: "*"
play: true
enabled: true
alias: Transfer Spotify Playback to Devialet device.
mode: single
icon: mdi:power
@maxve
I am not familiar with Devialet … but after Googling, it seems like it’s just a smart speaker device. At this point, I assume that you are able to play Spotify content from your phone to the Devialet speaker? If not, follow the How to use Spotify Connect? article on their web-site to do so. You have to have that working first (I assume that you do; just adding it for any future users that run across this thread).
With that said, let’s make sure you have the integration properly configured …
Step 1 - Verify Spotify Web API connectivity
First thing is to see if you can see your Spotify content via the HA Media Browser for the SpotifyPlus media player (named media_player.spotifyplus_max per your yaml example).
Browse to the following url: http://homeassistant.local:8123/media-browser/media_player.spotifyplus_max (change your url prefix if needed).
That should display the standard HA media browser with your SpotifyPlus media player selected. It should look something like the following (note my player name is SpotifyPlus Todd L, and I have custom icons associated with some of my Spotify content types):
Can you select your Spotify Playlist and Tracks content for the SpotifyPlus player?
If so, then that tells me the integration is configured correctly and you are able to access the Spotify Web API to retrieve Spotify data for your user account.
If not, then you will need to follow the integration install wiki page steps to configure the SpotifyPlus integration.
Step 2 - Verify you can Play Spotify Content via HA Media Player
If you don’t already have a SpotifyPlus media player dashboard configured …
Create a new dashboard with a standard HA media player instance using the following yaml:
It should look something line this (this is my player, powered on):
Power on the player, and select something from the media browser (e.g. playlist, track, etc) to play.
If nothing plays, then check your turn on script (see below).
If something does play, then that tells me you have everything in HA configured properly, and that the HA media player is talking to the Spotify Connect Player for the Devialet device.
Turn On Script
The turn on script will be executed when a turn_on service request is made to power on the SpotifyPlus integration. The script can be used to prepare the audio output device(s) (e.g. devialet in your case) for playing Spotify Connect Player content. In your case, you can place the select_source and volume_set steps from your Play liked songs automation into the turn on script (see Figure 1 below). This is similar to what I have to do for my Bose SoundTouch speaker(s) - in my case it selects the Spotify source on the Bose, and transfers Spotify playback to the Bose device.
Your Play Liked Songs Automation would then become just a trigger, and a call to the spotifyplus.player_media_play_track_favorites service. You may need to add a check in there to see if the SpotifyPlus integration (e.g. media_player.spotifyplus_max) is turned on, and issue a media_player.turn_on service call if necessary. For this test, just turn it on manually for now.
You can also associate your Devialet device with the SpotifyPlus player using the Configure options form (see below). In this example, I have my Bose-ST-1 speaker assigned as the default Spotify Connect Player for my media player.
Thanks a lot for the detailed answer. The issue is that the automation is not waiting for the turn_on script to finish before running the next service (play favorites).
This results in unstable behavior (music switches to devialet, and then switches back to my phone). But if I add 5 seconds delay in the automation between callin turn_on and play favorites then no glitches.
I would probably go with the script that is working and do not use the turn-on service included with SpotifyPlus. You just have to keep in mind that you will need to use a similar sequence for any other automations that start SpotifyPlus like this script does.
Just out of curiosity, I wonder what would happen if you replaced the script.turn_on with a media_player.turn_on with the SpotifyPlus turn on script option set to script.turn_on_spotifyplus? You may need to add a small wait delay (100ms?) after the media_player.turn_on to give the turn_on script time to get started so the wait_for_trigger \ script_finished can detect the event.
Hi guys, I have this simple code in HomeAssistant to play liked songs from Spotify in HomeAssistant. Don’t know if anyone wants to use it but it works.
type: custom:button-card
show_entity_picture: true
entity_picture: /local/images/logo/deezerr.png
tap_action:
action: call-service
service: media_player.play_media
service_data:
entity_id: media_player.first_echo_dot #this is your device ID NOT your group ID
media_content_id: my liked songs in homegroup group #here is where you place your group ID name. In my case my Alexa group name is called homegroup
media_content_type: SPOTIFY
template: radio_button
I have several Alexa’s and thus created a group.
If you also have a group just use 1 of your Alexa’s device name in the
entity_id name. If you use the groupname it won’t work.
At the line that says media_content_id that’s where you use the
Alexa group name. In my case “homegroup”
If you own just one Alexa device change that to the device’s name.
(yes I am aware that the deezerr.png logo is wrong. I’ve switched from deezer
to spotify but I am too lazy to change the image)