Controlling multiple SONOS stations via IFTTT and ActionTiles


#1

Not a big fan of IFTTT but for Things that do not fully integrate with SmartThings(ST), there is not a lot of choice. Case in point my SONOS speaker. I was looking for a way to play and control multiple stations I have saved in SONOS and so far I have not found a way to play a SONOS STATION/FAVORITE directly from a piston…a track yes but Station/Favorite no.

I created a Virtual switch in ST for each of my stations, created an IFTTT trigger to play each Station when the Switch was turned on and then added them all to my ActionTiles dashboard…all good.

But then I realized that when I “Changed” the station by tapping another tile, the new Station started to play but the old Tile stayed “ON”. And I did not want to have to write IFTTT triggers to turn off the stations and then be forced to turn one OFF before turning another ON

So I originally wrote a pile of IF statements to turn off all the other Switches (Stations) when a new one was turned on. It worked fine but was a maintenance nightmare as I had to change every IF statement every time someone asked me to add another of their favorites. So after a few hours of digging (I am not a coder and am new to ST/webCoRe/AT…2 weeks) and finding some inspiration from a Design Help Thread called [Remove Devices from a List Device] I was able to come up with this Piston that now works reliably. You simply need to make sure the StationList variable contains your entire list of Virtual Switches that point to your Stations and create the new IFTTT trigger if you add a station and that is the only maintenance you will need to do.

And here is what the ActionTiles dashboard looks like

To Pause everything simply tap the Station that is playing and the SONOS will pause since all the Switches/Stations are off.

I hope this is of some value.


#2

Great idea, thank you so much…

Just to confirm,
so if country button is pressed, IFTTT routine is triggered and IFTTT starts the station right?
And with your piston, every time new station is added all you do is, just add that switch to device variable.?


#3

You are correct. IFTTT handles all the ON events. But this piston basically makes sure all the other switches stay off in whatever “dashboard” you are using…in my case ActionTiles. It also Pauses my Sonos when I turn off all the switches from my dashboard.

The one thing missing is when the Sonos is paused by other Pistons. When I turn on my TV, the Sonos Pauses based on another Piston. I might add the logic here or more likely add similar logic to my TV controller piston to turn off all switches when I pause the Sonos…which would include hitting the Pause button on the speaker itself.

Although it would be nice to know which Station is in the queue in case a random Play event happens from somewhere or if I turn off the lst switch and then forget which one I was using. Action Tiles has a Sonos Music Tile that you can use to play and pause (which is in the jpg I attached) but it only shows current song and not the station name. ActionTiles does not have a generic info tile otherwise I could pull the Station Name from the Sonos device and display it on a tile. If I pause the Sonos from the Sonos tile, then my Station Tile will stay active so I can accomplish what I want that way…as long as I only play/pause from ActionTiles.

Close enough for now.


#4

I have a similar setup, and I too am disappointed with the lack of personalisation of individual tiles, in their last release you can change ALL tiles to a single background image, but not individually. Ideally I’d like to update a media tile to reflect what’s playing. Maybe in another year.


#5

Thank you I love it…
It was a bit hustle to turn off all other switches etc… Less is more… This piston will help me alot…
Thank you


#6

You are most welcome…Glad it was of some help.


#7

just a quick question, what applet are you using on IFTTT to get alexa stations?


#8

Definitely would be nice to control at least Text Display on an ActionTile. Was reading a thread yesterday and they are considering it but since their primary reason to exist is to support SmartThings, they seem to think that allowing us to control text on a tile is outside of their reason to exist…but it is under consideration.


#9

Sorry…No Alexa. My SONOS is added at a Thing in Smartthings. So I use the SONOS connection to IFTTT. And I use Google Home and/or Smartthings for control. I have Google Play Music and my personal music library and Radio by TuneIn and a couple other things added as services to SONOS. Any of the Stations from any of these sources you have saved as a favorite are exposed to the SONOS applet in IFTTT.

Thru Webcore I can do most everything that IFTTT does except play a Station…or maybe a URL radio station stream but i have not tried that yet.

Interestingly, IFTTT does not offer the ability to play a Track but you can do that directly in webCoRE.

I hope this answered your question.


#10

Perfect…
Actually I meant AMAZON MUSIC not Alexa:)))
Sonos has amazon music service…
With your instructions, I added my favorite Amazon stations to SONOS.
I can trigger each station with seperate applets in IFTTT
Now I can do exactly what you did in your piston…

:+1::+1::+1::+1::+1::+1:


#11

Glad it worked out for you…enjoy!