Announcement

Collapse
No announcement yet.

too many links for events

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • too many links for events

    I could create a huge amount of events for this but to me it would be much easier to maintain and administer through code.

    Here is what I am trying to do.

    When the master bathroom light is turned on...

    if it is night time play the night time nature playlist and do nothing else

    else if the surround sound is playing, link to it and do nothing else

    else if the kitchen sonos is playing link to it and do nothing else

    else if the living room sonos is playing link to it and do nothing else

    else if the bedroom sonos is playing link to it and do nothing else

    else play a random playlist.


    I already have the code for everything (checking the homeseer day/night, check if the sonos are playing, randomize a number and play that playlist, etc) everything except how to link from the bathroom sonos to one of the other sonos.

    Has anyone been able to figure out how to do that?

  • #2
    Yes. I remember when I wanted to do something similar in scripts, rather than having messy events, like it seems you are having. It took me a while to get it sorted out, but I figured it out by looking at the Sonos Plugin in the Object Browser in Visual Studio.

    To save you the effort:

    To link a player

    hs.PluginFunction("Sonos", <DestPlayer>, "Link", {<SourcePlayer>, True})

    To unlink a player

    hs.PluginFunction("Sonos", <DestPlayer>, "Unlink", {})

    Replace <SourcePlayer> and <DestPlayer> with your appropriate values "RINCON_000xxxxxxxxx" for each player

    Comment


    • #3
      Thank you!!!

      Comment

      Working...
      X