Wow! Jeg hadde skrevet funksjonen tidligere! ?
Sub Main(ByVal parms As String)
Dim devices() As String = parms.ToString.Split(",")
'Skrur alle på med et delay mellom hvert trinn
For Each d As String In devices
'Henter device ref
Dim dvRef As Integer = d
'Skrur den på
TurnOn(d)
'Venter et et kvart sekund mellom hvert trinn
System.Threading.Thread.Sleep(250)
Next
'Venter 5 sekunder
System.Threading.Thread.Sleep(5000)
'Skrur alle av med et delay mellom hvert trinn
For Each d As String In devices
'Henter device ref
Dim dvRef As Integer = d
'Skrur den av
TurnOff(d)
'Venter et et kvart sekund mellom hvert trinn
System.Threading.Thread.Sleep(250)
Next
End Sub
Sub TurnOff(ByVal input As Object)
Dim control As String = input
Dim devicevalue As Double = hs.DeviceValueEx(control)
Dim capi As HomeSeerAPI.CAPIControl = hs.CAPIGetSingleControl(input, false, "25", false, true))
If capi IsNot Nothing Then
hs.CAPIControlHandler(capi)
Else
hs.WriteLog("Trappetrinn Off", "Could not execute CAPIcontrol, it's nothing! (Input device value: " & devicevalue & ")")
End If
End Sub
Sub TurnOn(ByVal input As Object)
Dim control As String = input
Dim devicevalue As Double = hs.DeviceValueEx(control)
Dim capi As HomeSeerAPI.CAPIControl = hs.CAPIGetSingleControl(input, True, "on", False, False)
If capi IsNot Nothing Then
hs.CAPIControlHandler(capi)
Else
hs.WriteLog("Trappetrinn On", "Could not execute CAPIcontrol, it's nothing! (Input device value: " & devicevalue & ")")
End If
End Sub
Kalles med parameter (i ditt tilfelle) :
1870,1869,1868,1867,1884,1883,1882,1881,1898,1897,1896,1895,1912,1911,1910