Announcement

Collapse
No announcement yet.

Using Device API

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

  • Using Device API

    I have a need to access the device API in order to retrieve device type and control use information.

    Starting with this example directly from the HS3 Online Help:

    Example:

    Retrieve the DeviceTypeInfo object:

    Dim DT as DeviceAPI.DeviceTypeInfo = Nothing
    dv = hs.GetDeviceByRef(1234)
    DT = dv.DeviceType_Get(hs)
    If DT IsNot Nothing Then
    ...
    End If

    I don't get past line 1 without this error: "Type 'DeviceAPI.DeviceTypeInfo' is not defined"

    Ideas?
    Real courage is not securing your Wi-Fi network.

  • #2
    I know so little about this that I should probably keep my mouth shut, but have you tried splitting it into:

    Dim DT as DeviceAPI.DeviceTypeInfo
    DT = Nothing

    Or else use continuation:
    Dim DT as DeviceAPI.DeviceTypeInfo : DT = Nothing


    edit: nevermind--in my very limited experience I wasn't familiar with combining it as you did but with some googling see that what you've done should work.
    -Wade

    Comment


    • #3
      I hadn't, as it shouldn't make a difference. It didn't. The problem seems to be that DeviceAPI.DeviceTypeInfo is undefined.
      Probably something missing in that example, which really comes as no surprise.
      Real courage is not securing your Wi-Fi network.

      Comment


      • #4
        It's possible too I'm going in the wrong direction.
        Essentially, what I need to do is retrieve a list of valid CAPI controls for a given device. The example CAPI functions and their descriptions are no more helpful.
        Real courage is not securing your Wi-Fi network.

        Comment


        • #5
          Originally posted by Wadenut View Post
          I have a need to access the device API in order to retrieve device type and control use information.

          Starting with this example directly from the HS3 Online Help:

          Example:

          Retrieve the DeviceTypeInfo object:

          Dim DT as DeviceAPI.DeviceTypeInfo = Nothing
          dv = hs.GetDeviceByRef(1234)
          DT = dv.DeviceType_Get(hs)
          If DT IsNot Nothing Then
          ...
          End If

          I don't get past line 1 without this error: "Type 'DeviceAPI.DeviceTypeInfo' is not defined"

          Ideas?
          Try changing:
          Code:
          Dim DT as DeviceAPI.DeviceTypeInfo = Nothing
          to
          Code:
            Dim DT As DeviceTypeInfo = Nothing
          Greig
          Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
          X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
          Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
          Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
          Scripts =
          Various

          Comment


          • #6
            Well, there we go! Thanks.
            It would, as usual, be most helpful if the HS3 Help file were actually accurate. There's really no excuse.

            Still, somehow I need to retrieve a list of CAPI controls for a given device. That section of the help is no more helpful.
            Real courage is not securing your Wi-Fi network.

            Comment


            • #7
              Originally posted by Wadenut View Post
              Well, there we go! Thanks.
              It would, as usual, be most helpful if the HS3 Help file were actually accurate. There's really no excuse.

              Still, somehow I need to retrieve a list of CAPI controls for a given device. That section of the help is no more helpful.
              This might help you.

              Code:
                  Sub Main()
              
                      Dim strDevRef As Integer = 1234
                      Dim objDev As Object
                      Dim intDevRef As Integer
                      Dim intCount As Integer
              
                      hs.WriteLog("DevInfo", "Device : " & strDevRef)
              
                      intDevRef = CInt(strDevRef)
                      objDev = hs.GetDeviceByRef(intDevRef)
                      If objDev Is Nothing Then
                          hs.WriteLog("DevInfo", "Invalid device ref: " & strDevRef)
                      Else
                          hs.WriteLog("DevInfo", "Ref=" & strDevRef & "; Name=" & objDev.Name(hs) & "; Location=" & objDev.Location(hs) & "; Location2=" & objDev.Location2(hs) & "; Address=" & objDev.Address(hs))
              
                          intCount = 0
                          For Each objCAPIControl As CAPIControl In hs.CAPIGetControl(intDevRef)
                              hs.WriteLog("DevInfo", ".CCIndex=" & CStr(objCAPIControl.CCIndex) & "; Label=" & CStr(objCAPIControl.Label) & "; ControlType=" & CStr(objCAPIControl.ControlType) & "; ControlValue=" & CStr(objCAPIControl.ControlValue) & "; ControlString=" & objCAPIControl.ControlString)
                              intCount = intCount + 1
                          Next
                          If intCount = 0 Then
                              hs.WriteLog("DevInfo", "No CAPIControl objects defined for this device")
                          End If
                      End If
              
                  End Sub
              Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
              X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
              Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
              Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
              Scripts =
              Various

              Comment


              • #8
                That'll likely get what I need. I'll try a variation of it.
                Essentially all I really need is to retrieve the control associated with a single given value.
                Real courage is not securing your Wi-Fi network.

                Comment

                Working...
                X