Announcement

Collapse
No announcement yet.

HS3 Scripting Questions

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

    HS3 Scripting Questions

    I am switching from HS2 to HS3 and understand that the PI has pretty much been completely rewritten.

    Is there any scripting examples available for the HS3 version? I am using the HS3 Linux and Windows SONOS PI version (if that matters) on Windows.

    While I can do most desired functions with the standard plugin GUI. in HS2 I scripted the capability to enable/disable the wake alarm and set the time and playlist via HSTouch using scripting.

    I was using the Plugin("SONOSCONTROLLER") to get the player and then a GetMusicAPI("$zone_id") to get the zone object.

    I was then able to set the alarm params using the following (please excuse the perl syntax)
    $zone->SetAlarmParms("$set{AlarmID}","$set{StartTimeLocal}","$set{ Duration}","$set{Recurrence}","$set{Enabled}","$set{ROOMUUID }","$set{ProgramURI}","$set{ProgramMetaData}","$set{PlayMode }","$set{Volume}","$set{IncludeLinkedZones}");


    If I understand correctly, the same logic behind this really does not exist anymore (musicAPI).

    Is there anyway to access the alarm parameters using the new HS3 plugin (using scripting)? Or should I just give up on getting this functionality working in the "new world"?

    I appreciate any thoughts on this.

    Thanks,

    Lou

    #2
    Originally posted by gerlin View Post

    I was then able to set the alarm params using the following (please excuse the perl syntax)
    $zone->SetAlarmParms("$set{AlarmID}","$set{StartTimeLocal}","$set{ Duration}","$set{Recurrence}","$set{Enabled}","$set{ROOMUUID }","$set{ProgramURI}","$set{ProgramMetaData}","$set{PlayMode }","$set{Volume}","$set{IncludeLinkedZones}");


    If I understand correctly, the same logic behind this really does not exist anymore (musicAPI).

    Is there anyway to access the alarm parameters using the new HS3 plugin (using scripting)? Or should I just give up on getting this functionality working in the "new world"?
    The function is still there and it hasn't changed. You may want to search the HS3 forum on how you now call PIs.

    There are two topics you need to find:

    a/ how to pass multiple parameters into the function. You can find this on this forum, it is some structure you need to pass into the call
    b/ how to call the right instance. The instance name, you can see on the PLUG-INS->MANAGE webpage, it is the UDN (Unique Device Name) of the player. So the PI Name will be "Sonos" and the instance name something llike "RINCON_000E5832D2D401400" and then a parameter string.

    Here's the API again

    Code:
        Public Function SetAlarmParms(ByVal AlarmID As String, Optional ByVal StartTimeLocal As String = "", Optional ByVal Duration As String = "", _
                                      Optional ByVal Recurrence As String = "", Optional ByVal Enabled As String = "", Optional ByVal ROOMUUID As String = "", _
                                      Optional ByVal ProgramURI As String = "", Optional ByVal ProgramMetaData As String = "", Optional ByVal PlayMode As String = "", _
                                      Optional ByVal Volume As String = "", Optional ByVal IncludeLinkedZones As String = "") As String
            ' Enabled               False/True
            ' Recurrence            ONCE/WEEKDAYS/WEEKENDS/DAILY
            ' IncludeLinkedZones      False/True

    Comment


      #3
      Thank for the info. It took me a while to get back to this.

      I do have it working now and have posted the script and information on how I use it in the Script library.

      So if anyone is interested in working with Sonos alarms or just wants an example of working with the plug-in with a VB.NET have a look. Note that VB is not my native language, so it may not be as "clean" as it could be.

      HS3 Script for controlling Sonos Alarms

      Thanks again Dirk, you have always been very helpful and I really do appreciate it.

      Comment

      Working...
      X