I don’t have any lovelace cards on the playlist_add_items service, but it would be a simple button definition with an item click action calling the following service (adds the currently playing track to the end of a playlist):
@Tim_Br I put together a quick example using Mini Media Player with a shortcut button to add the currently playing track to a playlist. I also added a new UI Dashboards page to the SpotifyPlus project wiki that documents these examples.
Added service playlist_create to create a new Spotify playlist.
Added service playlist_change to change the details for an existing Spotify playlist.
Added service playlist_cover_image_add to replace the image displayed for a specified playlist ID.
Added service playlist_items_clear to remove (clear) all items from a user’s playlist.
Added service playlist_items_remove to remove one or more items from a user’s playlist.
Added service save_track_favorites to save one or more items to the current user’s track favorites.
Added service remove_track_favorites to remove one or more items from the current user’s track favorites.
Updated media_player.play_media method to better support play_media service enqueue features.
I also put together a quick example using Mini Media Player with a shortcut button to add / remove the currently playing track to the current user’s track favorites.
Check out the Add Track to Favorites example for what it looks like and the YAML configuration.
Updated media_player SCAN_INTERVAL to 1 second to inform HA of Spotify status updates in near real time (e.g. pause, resume, next track, etc).
Updated media_player.update logic to only call the spotifywebapiPython SpotifyClient.GetPlayerNowPlaying every 30 seconds OR if a player command is issued (e.g. pause, play, next / previous track, seek, volume, etc) OR if the current track is nearing the end of play (e.g. next track in a playlist or queue).
This update adds a few more calls to the Spotify Web API, but not many. The trade-off is near real-time updates of player status.
Added service follow_playlist to add the current user as a follower of a playlist.
Added service unfollow_playlist to remove the current user as a follower of a playlist
Added service follow_users to add the current user as a follower of one or more users.
Added service unfollow_users to remove the current user as a follower of one or more users.
Updated underlying spotifywebapiPython package requirement to version 1.0.40.
Added service turn_on and turn_off support for the player. Playback control is transferred to the player after turning on. Configuration options support the execution of scripts to allow external devices to be powered on and off. Refer to the wiki documentation on how to configure this feature.
Added support for media controls to properly function when the Spotify Connect Player loses the active device reference. For example, when the player goes into an idle state due to player pausing for extended period of time, you can now resume play without having to re-select the source (avoids No active playback device found errors).
I’ll try to answer your questions from our discussion in the Sonos Card thread:
Sonos is a Spotify Connect device, although I’m not sure the two companies are in complete sync with each others development.
I don’t use any scripts to power the device on because I don’t have to do so. Control everything for my Sonos devices from within the Sonos Card which allows access to anything offered by the Sonos device app and ecosystem. The Sonos Card uses the official Sono integration which exposes everything the Sonos can see, including Spotify (as long as the HA official Spotify integration is also installed. Everything is accessed through the HA media browser accessed from within Sonos Card.
I’m not using multiple Spotify accounts, just one premium paid account.
The error I’m receiving is still the same as you saw in the other thread. All of my play lists appear to have images, which were automatically assigned. The images are a single album cover, or a combination of 4 album covers depending upon what is in the playlist.
My Audio system consists of 4 Sonos devices as sources for a Russound 16 zone whole house amp system. I also still have a couple old Slim Devices/Logitech Squeezebox devices set up and sources for the Russound (which in some ways are still better than anything Sonos ever delivered).
I control the Russound zones with HA via individual media players or zone groups with scripts. Otherwise everything for the Sonos devices is controled within the Sonos Card.
I am able to use the Spotify app on my IOS devices to send playlists to the Sonos as a work around. Other wise I can get at any other Spotify Artist, album, or track through the Sonos Card via the media browser.
I hope some of all that helps you in some way and I will try to help further if I can. But I really don’t use Spotify Plus since it can’t play anything on my system except through my web browser. But I can at least browse Spotify playlists in it, so you are doing something right that the official Spotify integration isn’t…
@prgeno
Thanks for the info! I’m currently traveling for the Easter holiday, but will take a closer look on Monday.
At first glance, it seems like it might be better to approach the Sonos card developer (Phil?) about adding support for SpotifyPlus. He might not be open to that though.
I just installed and configured the integration, created just a card to test it, but everytime i try to play a song from my spotify i get an error about media_player.play media service telling me the media player created by this integration does not support this service. I have a free account…
Where am i wrong?
@maurizio53
Are you able to browse Spotify media via the HA Media Browser using the player? That will rule out an account configuration problem, versus a media player issue.
Are there any errors showing up in your system logs related to SpotifyPlus integration?
Before i was using spotcast integration and only on chromecasts devices as in sonos it was not working. I have many chromecast devices and some echo…
Hope you fix this as your integration has more interesting features.
@maurizio53
Regarding ChromeCast devices and SpotifyPlus, you will still need to utilize SpotCast to play to those devices. I have not tested SpotifyPlus with Sonos, as I do not have any Sonos devices (Bose SoundTouch guy).
I am trying to learn how existing Sonos users play content using the original Spotify integration - it seems that the few Sonos users I have encountered (@prgeno ) are using the Sonos card for that. I am not quite sure how the Sonos card works, so I will be taking a look at that in the next few days. Hopefully it’s something simple, or maybe the Sonos card developer(s) could add support for SpotifyPlus. I will keep you posted on that effort.
Ok, can you send me a code for example how to use spotcast with your integration? I still cannot use spotify with Sonos card so when you know how to do it, please let me know…
@maurizio53
I don’t have any SpotCast examples on how to use Spotify (nor SpotifyPlus) with Sonos gear. You might reach out to the Sonos Card developer @PunxsutawneyPhil to see if he has an example of playing Spotify on Sonos gear using the Sonos Card.
@maurizio53
Sorry, I should have been more clear. The only examples that I have for configuring SpotifyPlus is for the Bose SoundTouch line of gear, which does not require SpotCast. I don’t have any SpotCast examples on how to use Spotify (nor SpotifyPlus) with Google ChromeCast gear.
@prgeno
I had a chance to install and play with the Sonos Card today. I was able to successfully use it as a music player with the SpotifyPlus integration, keeping in mind that I do not have any Sonos devices attached. See Figure 3 below for an example.
I had to set the showNonSonosPlayers: true value in order for the Spotify, SpotifyPlus and SoundTouchPlus media players to show in the UI (obviously).
Some oddities that I noticed when using it with my Bose SoundTouchPlus integration media player:
Volume Changes - are not consistent among different media player types. For example, the Spotify and SpotifyPlus integrations were receiving the standard media player service command of set_volume_level to change the volume level. The SoundTouchPlus integration never received a set_volume_level service request, even though the Sonos Card volume slider adjusted to the new position.
Pause / Resume Play
A media_pause service command was received to pause the playing content, but after about 10 seconds the player would display No media selected if resume had not been selected. It would also not allow you to resume play if the resume button was clicked within 10 seconds. The player remained in a paused state as normal for the Spotify and SpotifyPlus integrations.
Some oddities that I noticed when using it with ANY non-Sonos (SoundTouchPlus, Spotify, SpotifyPlus) integration media player:
Media Browser Favorites - the Sonos Card keeps calling the async_browse_media method with a media content type of favorites. I believe this is to query Sonos specific favorites maybe? It does this for both my SpotifyPlus and SoundTouchPlus integration media players. I had to put defensive code into the integrations, as it was raising exceptions and adding a lot of entries to the system log since it calls it every 3-10 seconds (even with numberOfFavoritesToShow=0). There is no favorites equivalent for the Bose SoundTouch (it stores favorites on a per music service basis).
My next step is to add my findings to the SpotifyPlus wiki documentation, as I like the Sonos Card UI layout for playing Spotify content. It’s a really cool player interface!
There are too many issues to recommend it for use with the SoundTouchPlus integration though. This is not a bad thing, as the developer probably did not have any Bose SoundTouch devices to test with (just like I don’t have any Sonos devices to test with). It’s near impossible to develop an integration for technology that you do not have on hand, and expect it to work flawlessly.
Anyway, hope it helps!
Figure 1 - SpotifyPlus Media Library
Notice the “Made For You” node item for browsing the Spotify “Made For You” content (see Figure 1a below). It also allows you to customize each media library index node with a custom image if you like.