SmartThings Community

Automatic spotify connect player


(Marcus) #1

Hello there,

i actually wanted to check if anybody has a solution to automatically play spotify playlists on triggering a sensor or device.

Ideally, this works with the spotify connect feature to automatically move the song playing to where i am in the house.
I know that something like this should be possible with Sonos… however is there another solution to use all of the speakers i already have at home? Maybe chromecast audio?


(Jon) #2

@AlmostSerious did you manage to find a solution for this? I would be very interested if you did.


(Marcus) #3

No, unfortunately not. However, best bet on achieving this seems to be Bose Soundtouch, as you can put 6 presets that can then be triggered via smartthings. A preset could be a Spotify Playlist. However, currently im simply using the ECHO to just say play spotify… and thats fine for now.


(Micah Benson) #4

Anyone? Anyone? Bueller??? Ferris Bueller???

Has anyone worked on this? It would be really cool to have a trigger to just start playing a spotify playlist without having to pull my phone out and fiddle… IE walk in the door, lights go on and some music kicks on as well.


(John Dell Arciprete) #5

Use Alexa if you have one.

“Play (song name) on Spotify” (You may have to add the artist in there if there are multiple songs with the same name)
“Play (artist name) on Spotify” (Shuffles songs by that artist)
“Play (composer) on Spotify” (Shuffles music from that composer)
“Play (playlist name) on Spotify” (You can also say “Shuffle” instead of “Play”)
“Play (genre) on Spotify” (90s music, rock, hip-hop, etc)


(YankeeJohnboy) #6

Theory: Perhaps you could use a combination of Sharptools by @joshua_lyon (android) for presence/sensor triggers, and then utilize tasker with the Macronos plugin to trip off the playlist of choice on Sonos… you can take pieces from this article for inspiration. I fully admit this is more dependent on android than ST, but it’s all I can think of at present to satisfy the use case…


(Joshua Lyon (SharpTools.io Dashboard)) #7

Still great to put the idea out there - you never know how your thoughts might inspire creativity with someone else!

Following on the idea from @YankeeJohnboy, you could use something like AutoLocation to detect when you are home and then use something like AutoInput to automate the screen presses to cast the audio. Again, this is still tied to your phone.

If you’re willing to get your hands dirty, you might be able to take some of the work done in this Node.JS project and extend it for your needs (or something similar - this was just a quick search!):


(Iain Aspley) #8

You can use HAM Bridge for AppleScript automation, it allows firing of specific playlists dependent on many triggers using the SmartApps by @scottinpollock.

I’ve used it to make a media controller for Spotify and iTunes that can be controlled by nearly anything, including a virtual remote in the ST app. https://github.com/ijaspley/HAM-Bridge-Smartthings-Media-Control


(Marcus) #9

I finally made it happen by using Home Assistant. Right now im using Home Assistant and Smartthings in paŕallel. Implementation of Spotify in HA was pretty easy. Now my ST paired sensors trigger my HA Automations including Spotify :slight_smile:


(Nei Kaye) #10

Marcus
I would very much like to know more detail on how you got this to work.
I was hoping AT tiles would offer a solution but Action tiles, Fully Kiosk and Spotify dont play nicley
Best
Neil


(Marcus) #11

I recommend to check out their Website. www.hass.io
Im running it on a rpi3.


(Nate Hales) #12

If someone knows how to find me a command line in Windows that will start a specific Spotify playlist, I will have it working for in SmartThings the same day. We can control anything on Windows if we know the command line. Aka if you can fire a playlist in command prompt we will do the rest.


(Iain Aspley) #13

You need to right click the playlist in the web player to get the URL which includes the proper name of the playlist (they have weird names (list of characters), not obvious ones like ‘discover weekly’), then you can pass this into your prompt.


(Nate Hales) #14

I DID IT!!! Start Spotify Playlists with Smartthings and Trigger CMD Here is a video of how to do it.
https://youtu.be/5LNVrFHCKkA


(Andy Hawks) #15

Solutions for getting SmartThings to automate playback of Spotify playlists on Sonos devices:

  1. If you have a Harmony Hub, create Harmony activities for playing your playlists on the Sonos then invoke those Harmony activities from ST (this is the most reliable and close to native solution. It is my recommended solution).
  2. If your Sonos is near a voice assistant, use an ST smart app or webCoRE to have the Sonos speak to Alexa/Google to trigger the playlist (e.g. "Alexa play playlist in the “”
  3. Duplicate your Spotify playlist tracks into a Sonos playlist and play that - ST can play Sonos playlists
  4. Duplicate your Spotify playlist tracks into a webCoRE Piston and use the piston
  5. Use a software tool like TRIGGERcmd that integrates with ST to trigger the playlist from your desktop. Video here: https://youtu.be/5LNVrFHCKkA

(Chris Hanson) #16

Spotify has an API that supports commands to all connect devices via rest commands so it should be doable…


I suck at developing tho, so I just keep getting “groovyx.net.http.HttpResponseException: Unauthorized @line 116 (pause)”
I would appreciate help if anyone smarter than me is willing!
def pause() {
log.debug “Executing Pause”
httpPut(

    uri: "https://api.spotify.com/v1/me/player/pause",

    body: [contentType: "application/json", token_type: "bearer", access_token:"NotMyRealTokenObviously"] 

)

}