If "Sonos paused" flow

Hi,

You can currently trigger a flow on Sonos album, artist, volume, track change; I’d love to be able to trigger on play state change play -> pause or pause -> play. I suspect you are currently subscribing to things like playerVolume to provide the current triggers; you’d just have to add a subscription to playback status to provide the trigger I am looking for. I would have happily added/enhanced this myself if the Sonos App was open source, but that does not appear to be the case.

Thanks,
Martijn

1 Like

Actually, forget about it, did my own app in which I can also resume playing on a particular speaker after it has left a group in a reliable way and this not somehow restarts the speakers in the old group as tends to happen with the current Sonos flows.

Do u care to share?

1 Like

Well, it’s probably not very useful for others; I really just implemented this for my own exact situation with hardcoded device and room names, etc.

So it’s not on github yet? :wink:

Sure there is: https://github.com/escabe/org.escabe.mysonos I just don’t think it is very useful for many others.

The basic thing I wanted to have is: if alarm sounds, group bedroom, bathroom and living room speakers together and play a radio station on that group. Then if I stop my bedroom speaker, I want the living room speaker to continue playing.

This was not possible before: there was no “bedroom stopped playing” to trigger on; my App implements that. Also there is no good reliable way to first remove a speaker from a group and then have that speaker play something…with the current Homey Sonos App, this typically results in the old group playing instead of that speaker I had just ungrouped…unless I add some delay of at least 10 seconds, but I don’t want that 10 second gap in audio. My App implements a new action which ungroups the livingroom speaker and once that has been completed, specifically tells that same speaker to resume playing again.

As you can see though if you look at the sources, I hardcoded the way in which I indentify the living room and bedroom speakers.

1 Like

I’m no programmer but is it a lot of work to change the “hardcoded” way into a way the community can enjoy your version?

Well, for the community to be able to properly enjoy this, I’d need to add proper device discovery, implementing a Driver, etc. Which I assume basically already exists in the current Sonos support as offered by the official App…I don’t really feel like replicating all that work, I’d be easier/better if the official App was enhanced to support this.

Aa a non developer that sounds understandable. :grimacing:

Screenshot_20190709-102208

Hi Martijn,
I also want to be able to check if a specific Sonos device or group starts or stops playing in the flow:When section.
In Homey version 4.0.0. this is still not available. Today I have filed a feature request at Athom.
I will post an update as soon as I have received a reply from Athom.

1 Like

I was wanting something similar, basically I have a virtual button which allows me to start a flow for Alexa. Problem was, as you can’t check on play/pause the button would get out of sync if the Sonos is started via App or on a timer etc.

What I did was setup a timer, so every 1 minutes I check IF the Sonos if playing, then I turn on the button, else I turn off. Works well, as long as you aren’t concerned about the small delay. I expect you could do it every second, but not sure how that would affect then Homey.

Just need to check that the flow for starting the Sonos also checks, otherwise it constantly restarts the playlist.