How to check if speaker isn't actively playing music

Posted on
Mon Oct 09, 2017 8:55 am
zini offline
Posts: 59
Joined: May 19, 2013

How to check if speaker isn't actively playing music

I am trying to create a trigger that will periodically check and see if my zones are actively playing music, and if not, will restart them playing a favorite station.

Sorry if this has been covered somewhere, but I haven't been able to find this anywhere. What variable do I use to accomplish this? Assuming it's under the "device state changed" options.

Thank you in advance!

Mark

Posted on
Mon Oct 09, 2017 8:59 am
roussell offline
User avatar
Posts: 1108
Joined: Aug 18, 2008
Location: Alabama

Re: How to check if speaker isn't actively playing music

I do something similar in a few situations; I forget the exact trigger, but I check the state of the device and if the state "is not playing", I do some action. I can look a little later and see exactly what it is if you can't find it.

Terry

Posted on
Mon Oct 09, 2017 9:08 am
roussell offline
User avatar
Posts: 1108
Joined: Aug 18, 2008
Location: Alabama

Re: How to check if speaker isn't actively playing music

Actually, I did trigger off of any change. Here is an example that turns off a sub amp on the patio if the Sonos outside isn't playing. I did it this way to avoid the trigger firing when the Sonos is transitioning between songs/stations/playlists.
Screen Shot 2017-10-09 at 10.02.13 AM.png
Screen Shot 2017-10-09 at 10.02.13 AM.png (61.06 KiB) Viewed 1548 times

Screen Shot 2017-10-09 at 10.05.32 AM.png
Screen Shot 2017-10-09 at 10.05.32 AM.png (120.99 KiB) Viewed 1548 times

Screen Shot 2017-10-09 at 10.02.50 AM.png
Screen Shot 2017-10-09 at 10.02.50 AM.png (79.91 KiB) Viewed 1548 times



Terry

Posted on
Tue Oct 10, 2017 9:16 am
zini offline
Posts: 59
Joined: May 19, 2013

Re: How to check if speaker isn't actively playing music

Terry,

Awesome! Thanks for the quick response. I used the same setup you use and it seems to be working great. This is a great method to keep music always on, even if something like an internet stream times out.

Mark

Posted on
Thu Oct 12, 2017 10:04 am
zini offline
Posts: 59
Joined: May 19, 2013

Re: How to check if speaker isn't actively playing music

Terry,

Is there a published list somewhere of the speaker states for the plugin? When I run the STOPPED and PAUSED states as conditions in a schedule it doesn't seem to work. If I manually execute the schedule, it works perfectly. So it seems like it's something with the plugin not properly understanding the state of the speaker.

Any thoughts?

Mark

Posted on
Thu Oct 12, 2017 10:16 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: How to check if speaker isn't actively playing music

Have you checked the custom states listed beneath the device in the main Indigo UI?

Select a device in the main UI and then make the display in the lower pane larger or scroll it. I don't use the Sonos plugin (I haven't got any Sonos devices :wink: ) but plugins list their custom states in the lower pane.

This may help if you haven't discovered these already. :)

Posted on
Fri Oct 13, 2017 9:51 am
zini offline
Posts: 59
Joined: May 19, 2013

Re: How to check if speaker isn't actively playing music

Ahhh... got it. Makes sense. This helps a lot! By looking at these, I was able to figure out that changing the condition to "contains" instead of "equals" has solved my issue.

Thanks for the help!

Mark

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests