Hi folks - hoping someone can help. I’ve successfully created a script which uses the play_media service to play a MP3 file stored on a standard URL (e.g. domain.com/test.mp3). However I am unable to get this to work using Spotify (I’m a premium subscriber). I have tried all of the URL options from the Spotify PC app, such as below, to no avail. Does anyone have any suggestions?
Both of those work for me, but both also require a click to start the song. The Spotify API does not support auto playing. There is a reverse engineered API for the local spotify server, but the implementation hasn’t been updates since 2013.
Damn Spotify and their API’s
Thanks for the feedback. Makes sense - so any link needs to be directly playable or to a direct file (e.g. MP3 or whatever) it seems. I guess the next best thing is to just use the media_play command to resume whatever was last playing.
How can we play an MP3 file on Sonos? I am thinking of sending pre-recorded notification messages to Sonos.
Here’s an example of a script playing a particular mp3
alias: 'Leave for Work'
- service: media_player.sonos_snapshot
- service: media_player.volume_set
- service: media_player.play_media
- service: media_player.sonos_restore
Found some solution to stream a Spotify playlist with home assistent?
You can download tracks from Spotify and add them to the script. Normally you won’t be able to play Spotify songs outside its app, so you have to download it with a tool Spotify Music downloader. I’ve tried this many times and it never fails.
Hi, how does this work? You are using both Sonos integration and spotify integration on HA, and you pass a spotify URI to Sonos but you won’t get it to autoplay?
I guess Spotify have DRM protection so you can’t get this to work using Spotify,maybe you can try to convert Spotify to MP3 then try again ?
Spotify premium users can directly listen to Spotify Music through Sonos. Free Spotify users must need a professional Spotify playlist converter to locally save music from Spotify and then add local Spotify music files to Sonos for offline playback.