Trying to convert this script from HS2-HS3 that captures device changes to a virtual device. I have this script references in the startup.vb but the virtual device (v10) is not updating. I suspect it has to do with how the devices are referenced now?
Code:
Sub Main(ByVal Parms As Object) hs.writelog("Callback", "Registering for status change callback...") hs.RegisterStatusChangeCB("callback.vb", "Callback") End Sub Sub Unregister(ByVal Parms As Object) hs.writelog("Callback", "Unregistering for status change callback...") hs.UnRegisterStatusChangeCB End Sub Sub Callback(ByVal Parms As Object) Dim DCheck() As String ={"N1", "N3", "N5", "N7", "O1", "O3", "O5", "O7", "O9", "O11", "O13", "O15"} Dim DevStr As String = "V10" 'virtual device to update For Each s As String In DCheck If Parms(0) & Parms(1) = s Then hs.writelog("Callback", "In the array...") If Parms(2) = 2 Then hs.writelog("Callback", "Device: " & Parms(0) & Parms(1) & " has turned on") 'hs.setdevicestring(DevStr, hs.devicestringbyname(Parms(0) & Parms(1)), True) hs.setdevicestring (DevStr, hs.getdevicebyref(parms(3)).location, True) End If End If Next End Sub
Comment