Announcement

Collapse
No announcement yet.

Help with scripting and object model

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

  • Help with scripting and object model

    I'm trying to use Homeseer to integrate a multi-source/zone amplifier (Russound) with my Pioneer amplifier. I need to write some VB.Net scripts to achieve this. But am struggling getting my head around the object model for UltraPioneerAVR.

    I can see in the VB object browser (using tenScripting) two classes in HSPI_ULTRAPAVR: HSPI and PioneerAVR. I can access the HSPI class using something such as

    Dim PioneerPI As HSPI_ULTRAPAVR.HSPI
    PioneerPI = hs.Plugin("UltraPioneerAVR")

    then get properties/execute methods such as PioneerPI.GetPioneerAVRs successfully.

    However, it looks like the control functions I really need access to are in HSPI_ULTRAPAVR.PioneerAVR such as


    - DoZone2Command(ByVal strCommand as String, ByVal strCommandArgs as String)
    - DoMasterControlCommand(ByVal strCommand As String, ByVal strCommandArgs As String)

    But I can't find any documentation on

    a) how to even get access to an instance of the PioneerAVR class. For example the Russound plugin is similar in implemented multiple classes, but the HSPI class has a method such as GetMultiZoneAPI() to get an instance of one of the other classes.

    and

    b) Even if I has an instance of HSPI_ULTRAPAVR.PioneerAVR, what should be passed in the parameters to the Do*****Command methods?

    A simple example such as what is the current volume on zone 1, or zone 2 power status would be a great start.

    Any help would be greatly appreciated.
    Thanks,
    John.

  • #2
    The plug-in was designed to communicate with the receiver using HomeSeer events. You can also control the receiver using HomeSeer devices by setting and reading the device value and device strings.

    In the following example, :41 is the device code for the master volume of one of my receivers and :50 is the volume for zone 2 of the same receiver.

    Here is an example on how to read the master and zone2 volume:

    Code:
    Sub Main(parm as object)
    
      Dim hspi = hs.Plugin("UltraPioneerAVR")
    
      Dim iVolume as Integer = hs.DeviceValue(":41")
      Dim strVolumeDb as String = hspi.FormatVolumeDB(iVolume)
    
      hs.WriteLog("Debug", String.Format("Master Volume is {0}", strVolumeDB))
    
      Dim iZoneVolume as Integer = hs.DeviceValue(":50")
      Dim strZoneVolumeDb as String = hspi.FormatZoneVolumeDB(iZoneVolume)
    
      hs.WriteLog("Debug", String.Format("Zone2 Volume is {0}", strZoneVolumeDB))
    
    End Sub
    You can interact with the receiver by setting the HomeSeer device value. In the following example, ":40" is the HomeSeer device code for one of my receiver's master power. Here is an example on how to toggle the power of a receiver:

    Code:
    Sub Main(parm as object)
    
      Dim hspi = hs.Plugin("UltraPioneerAVR")
    
      ' Toggle power
      hs.SetDeviceValue(":40", 3)
    
    End Sub
    If you need to use scripting, then you can get the list of acceptable values for each device by viewing the HomeSeer status web page, then looking at the HTML source code for a list of values and their associated names.


    Regards,
    Ultrajones
    Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

    Comment


    • #3
      That is perfect. Thank you!
      Regards
      John.

      Comment

      Working...
      X