Announcement

Collapse
No announcement yet.

Transition from HS3 Dimmer Sync VB Script

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

    Transition from HS3 Dimmer Sync VB Script

    Currently running HS3 and I am about to upgrade to HS4 but want to be ready to update a few minor scripts I already have in HS3.

    Two questions

    1.) Do hs.DisableEvent & hs.EnableEvent commands still work as in HS4?

    2.) I am using the below script as a way to sync companion dimmers either 2, 3, or 4 way, but also use it for a "master dimmer" that controls 10 dimmers on my main floor.

    Can someone tell me what I will need to change to make compatible with HS4? I think I will need to use hs.SendControlForFeatureByValue(Int32, Double) instead of hs.CAPIControlHandler ?

    Current Code:

    Sub Main(ByVal Parms as String)

    Dim i As Long
    Dim ParmArray() as String
    Dim devMasterValue As Double

    ParmArray = Parms.tostring.split(",")

    devMasterValue = hs.DeviceValue(CDbl(ParmArray(0)))

    Select Case devMasterValue
    Case 1 to 98
    For i = 1 To ubound(ParmArray)
    hs.CAPIControlHandler(hs.CAPIGetSingleControl(CDbl(ParmArray (i)), False, CStr(devMasterValue), False, True)
    Next
    Case 99
    For i = 1 To ubound(ParmArray)
    hs.CAPIControlHandler(hs.CAPIGetSingleControl(CDbl(ParmArray (i)), false, "On", false, false))
    Next
    Case 0
    For i = 1 To ubound(ParmArray)
    hs.CAPIControlHandler(hs.CAPIGetSingleControl(CDbl(ParmArray (i)), false, "Off", false, true))
    Next

    End Select

    End Sub

    #2
    CAPI controls should work as in HS3
    tenholde

    Comment

    Working...
    X