Jump to content
C4 Forums | Control4

How to programmatically determine if a room is playing music?


DLite

Recommended Posts

I have two outdoor zones -- Back Patio and Back Yard.  I'd like to write code that joins the two zones together if either one is playing music.  I'd like the code to do something like the following:

If Back Yard is playing music, then use Room Control driver to set Back Yard as music source and Back Patio as music destination;

Else if Back Patio is playing music, then use Room Control driver to set Back Patio as music source and Back Yard as music destination.

 

I'm struggling to figure out the most efficient way to design the "if [Room] is playing music" conditional.  We use Sonos equipment.  I know that I could do something like the following:

If (Back Yard source is Back Yard Sonos & Back Yard Sonos is Playing) OR (Back Yard source is Kitchen Sonos and Kitchen Sonos is Playing) OR Etc etc

However, since we have 12 different Sonos zones, any of which could be the source, this approach is incredibly cumbersome, and I'm assuming there has to be a better way.  What am I missing?

Thanks!

Link to comment
Share on other sites


59 minutes ago, Neo1738 said:

When Back Patio audio selected is xyz 
? Back Yard is off
 -> Room control join zones

Thanks!  Would you mind clarifying the following details:  for the first step, would I be using the "Current_Selected_Device" room variable, the "Playing_Audio_Device" room variable, or something else?

Link to comment
Share on other sites

I like using the room control driver event "Listen device selected" as a "music is playing here now" trigger.

If you're specifically only using Sonos, look deeper into the Sonos network driver events/actions, since that is what directly controls Sonos matrix. On the output tab of the network driver events, "When audio [int] changed" directly correlates to the Sonos room joins, and is bidirectional with C4 at this point. "Audio x" is determined by which rooms are connected to the network driver audio zones. When I program stuff like this I like to have a list of each Sonos zone written down and the corresponding C4 Sonos network audio number that's associated with it.

Link to comment
Share on other sites

2 hours ago, jlemonakis said:

I like using the room control driver event "Listen device selected" as a "music is playing here now" trigger.

If you're specifically only using Sonos, look deeper into the Sonos network driver events/actions, since that is what directly controls Sonos matrix. On the output tab of the network driver events, "When audio [int] changed" directly correlates to the Sonos room joins, and is bidirectional with C4 at this point. "Audio x" is determined by which rooms are connected to the network driver audio zones. When I program stuff like this I like to have a list of each Sonos zone written down and the corresponding C4 Sonos network audio number that's associated with it.

Thanks! I never thought to look there.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.