Announcement

Collapse
No announcement yet.

Help setting VS/VG pairs in existing devices via script

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

  • Help setting VS/VG pairs in existing devices via script

    I have about 100 devices created by a plug-in. These devices can have one of three values assigned to them. I would like to set the same status text and graphics to all of them.

    Since I am very weak at scripting I would appreciate some help. I don't want to automate all of them at once, but would like to pass a RefID to a script and have that script assign the text and graphics to the three values at once. Running the script manually on each device would still be less tedious than setting the devices manually one by one.
    Randy Prade
    Aurora, CO
    Prades.net

    PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

  • #2
    Hi Randy,

    Here's a sub-routine that I have used for creating VS/VG pairs. The subroutine requires 7 parameters to be passed to it. They should all be self-explanatory, but if not, let me know.

    Cheers
    Al

    Code:
    Sub CreateVSVG(ByVal Parms As String)
    
    	Dim ParmArray() As String = Parms.tostring.split(",")		'split parameter into an array
    	Dim refDev As Integer = CInt(ParmArray(0))		' dev code
    	Dim vsName As String = ParmArray(1)		
    	Dim vsValue As Integer = CInt(ParmArray(2))		
    	Dim row As Integer = Cint(ParmArray(3))
    	Dim col As Integer = Cint(ParmArray(4))
    	Dim colspan As Integer = Cint(ParmArray(5))
    	Dim iconName As String = ParmArray(6)		
    
    	dim GPair as VGPair
    	dim SPair as VSPair
    
    	SPair = New VSPair (HomeSeerAPI.ePairStatusControl.Both)
    	SPair.PairType = VSVGPairType.SingleValue
    	Spair.Render_Location.Row = row
    	Spair.Render_Location.Column = col
    	Spair.Render_Location.ColumnSpan = colspan
    	Spair.Value = vsValue
    	Spair.Status = vsName
    		
    	If iconName > "" Then 
    		Spair.Render = 5
    		Spair.PairButtonImageType = 1
    		GPair = New VGPair
    		GPair.PairType = VSVGPairType.SingleValue
    		GPair.Set_Value = vsValue
    		GPair.Graphic = "/images/wdtv/remote/" & iconName & ".png"
    		hs.DeviceVGP_AddPair(refDev, GPair)
    	End If 
    	hs.DeviceVSP_AddPair(refDev, SPair)
    
    end sub
    HS 3.0.0.548: 1990 Devices 1172 Events
    Z-Wave 3.0.1.262: 126 Nodes on one Z-Net

    Comment


    • #3
      Originally posted by sparkman View Post
      Hi Randy,

      Here's a sub-routine that I have used for creating VS/VG pairs. The subroutine requires 7 parameters to be passed to it. They should all be self-explanatory, but if not, let me know.

      Cheers
      Al
      Thanks. It all makes sense to me. I'll give it a go in a little bit. I'll post back if any questions.
      Last edited by rprade; March 19th, 2017, 04:17 PM.
      Randy Prade
      Aurora, CO
      Prades.net

      PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

      Comment

      Working...
      X