Announcement

Collapse
No announcement yet.

Polling results always show 0 as the value and result

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

    Polling results always show 0 as the value and result

    Hello all:

    I have been tinkering with Homeseer 4 scripting. (very weak at this) Thanks to Tenholder and Jon00, they both assisted me in scripts to turn on, off, dim or poll an Insteon Device. To control the device on or off works great however when I poll the device with the following script I always get a result and value of 0 when the device is on. We can't figure this out. Here is the script:

    Public Sub Main(ByVal Parms As Object)
    ''
    '' Extract Parms --> ParmArray
    ''
    Dim ParmArray(0) As String
    '' Determine if Parms is a single String, or an Array of Strings
    If Parms.GetType().ToString = "System.String" Then
    '' Single String from HS scripting engine. Extract parms
    ParmArray(0) = ""
    If Parms.ToString.Contains("|") Then
    ParmArray = Parms.ToString.Split(Convert.ToChar("|"))
    Else
    ParmArray(0) = Parms.ToString
    End If
    Else
    '' Array of strings from HsTouch
    ParmArray = CType(Parms, String())
    End If
    '' ParmArray() now contains one or more passed parameters
    Dim DevRef As Integer
    Dim cc As HomeSeerAPI.CAPI.CAPIControl
    Dim cr As HomeSeerAPI.CAPI.CAPIControlResponse
    DevRef = CInt(ParmArray(0)) 'get device reference number from first (only) parameter
    cc = hs.CAPIGetSingleControl(DevRef, True, "Poll", False, False)
    cr = hs.CAPIControlHandler(cc)
    End Sub​

    The Parameter is 188.

    Here is the log:

    5/29/2023 12:57:22 PM Script Poll Insteon Device Ref: 188 Result: 0 Value: 0
    5/29/2023 12:57:22 PM HomeSeer Device Control Device: Unknown3 Bed Bath Lights - Root Bed Bath Lights to Poll (Execute Script) by/from: CAPI Control Handler
    5/29/2023 12:57:22 PM HomeSeer Event Running script in background (New Event): PollADevice.vb
    5/29/2023 12:57:22 PM HomeSeer Event Event Trigger "Test New Event"​

    Not sure is this is a bug in Homeseer 4. Any help would be much appreciated.

    #2
    Have you tried executing the CAPI command from tenScriptAid? If so, is there anything interesting in the log?
    tenholde

    Comment


      #3
      It seems to work fine in your app. Not when I create the script on homeseer. Turning on and off a device works fine with your script. Polling doesn't.

      Comment

      Working...
      X