Announcement

Collapse
No announcement yet.

Status Of Single Value Pair

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

    Status Of Single Value Pair

    I'm not sure if I am just missing this but I'm trying to build an action in one of my plugin to set the status (ie value) of another device. This is not to control a device, I want to set it's status from an event.

    I know I can do it with a single line hs.setdevicevalue and it'll do the same but I like neatness and I would like it in an event action.

    Going through the VSPair class I see that there is the .status, I've used it before setting up VSPairs but if you call hs.DeviceVSP_GetAllStatus then it will return an array of VSPairs. I can't quite understand why the .status call is a writeonly property? It would therefore if I understand it correctly impossible to get the status of a single value pair from this call?

    #2
    I have some built-in functions to dump devices and their data - this is a snippet on how to get the .IntStatus and .Value

    Code:
     vs = hs.DeviceVSP_GetAllStatus(dev.Ref(hs))
                For x = 0 To vs.Length - 1
                    vsp = hs.DeviceVSP_Get(dev.Ref(hs), vs(x).Value, ePairStatusControl.Both)
                    If (Not vs(x) Is Nothing) Then sb.Append("VSPair [" & vsp.intstatus & "] =[" & vsp.Value & "]" & vbCrLf)
                Next
    Hot sure if this helps or not.
    HS4Pro on a Raspberry Pi4
    54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
    Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

    HSTouch Clients: 1 Android

    Comment


      #3
      This might help:

      http://tenholder.net/tenWare2/tenScriptAid/default.aspx

      tenholde
      tenholde

      Comment


        #4
        Originally posted by tenholde View Post

        I'm getting errors with tenScriptAid version 1.26. I can hit continue and things work.

        There's also no "code icon" next to the VSPairs box. Can that be added? I'm trying to get exactly what you have listed in that box.

        Thanks

        Comment


          #5
          Originally posted by jeubanks View Post
          I'm getting errors with tenScriptAid version 1.26. I can hit continue and things work.

          Could you post the error you are getting upon startup please,

          tenholde
          tenholde

          Comment


            #6
            Originally posted by jeubanks View Post
            There's also no "code icon" next to the VSPairs box. Can that be added? I'm trying to get exactly what you have listed in that box.

            Thanks
            Here is the code I use to populate the ListBox lstVsPairs

            Code:
            '' VsPairs
                    VSPs = hs.DeviceVSP_GetAllStatus(DevRef)
                    Log("    Numbers of VsPairs: " & VSPs.Count.ToString)
                    lstVsPairs.Items.Clear()
                    For Each Vsp In VSPs
                        If Vsp.PairType = VSVGPairType.SingleValue Then
                            '' Single Value Entry
                            d = Vsp.Value
                            s = hs.DeviceVSP_GetStatus(DevRef, d, ePairStatusControl.Both)
                            lstVsPairs.Items.Add(d.ToString & "=   " & s)
                        ElseIf Vsp.PairType = VSVGPairType.Range Then
                            '' Multiple Value Entry
                            Log("    VsPair:  RangeStart:" & Vsp.RangeStart.ToString & "  RangeEnd:" & Vsp.RangeEnd.ToString)
                            lstVsPairs.Items.Add("RANGE: " & Vsp.RangeStart.ToString & " TO " & Vsp.RangeEnd.ToString)
                            s = hs.DeviceVSP_GetStatus(DevRef, Vsp.RangeStart, ePairStatusControl.Both)
                            lstVsPairs.Items.Add("    " & Vsp.RangeStart.ToString & "=  " & s)
                            s = hs.DeviceVSP_GetStatus(DevRef, Vsp.RangeEnd, ePairStatusControl.Both)
                            lstVsPairs.Items.Add("    " & Vsp.RangeEnd.ToString & "=  " & s)
                        End If
                    Next
                    lstVsPairs.Refresh()
            tenholde
            tenholde

            Comment

            Working...
            X