Ser at dette er en gammel tråd. Men hadde det samme problemet som TS. Fikk hjelp fra homeseer forumet. En som lagde sin egen versjon. Det fungerte hos meg som kjører HS3 Pro på win10.
Sub Main(ByVal Parms As String)
'Use the reference ID of the door or window sensor devices in the arrays below
'This script work for devices that have a value of 0 when they are secure and greater than 0 If they are not
Dim WindowArray() As Integer = {8152,8129,8086,8123,8158}
Dim DoorArray() As Integer = {1017,1018,1146,6370}
Dim DoorDev As Integer = 8259
Dim WindowDev As Integer = 8260
Dim Debug As Boolean = True
Dim LogName As String = "Door-Window"
Dim WindowCount As integer = 0
Dim WindowName As string = ""
Dim WindowDevString As string = ""
Dim DoorCount As integer = 0
Dim DoorName As String = ""
Dim DoorDevString As string = ""
Dim dv As Scheduler.Classes.DeviceClass
Try
'Windows
For Each Window As Integer In WindowArray
dv = hs.GetDeviceByRef(Window)
WindowName = dv.Name(hs)
If Debug Then hs.writelog(LogName, "Window " & WindowName & " | Value " & hs.DeviceValue(Window))
If hs.DeviceValue(Window) > 0 Then
WindowCount = WindowCount + 1
WindowDevString = WindowDevString & WindowName & ",<br>"
If Debug Then hs.writelog(LogName, WindowName & " Open")
End If
Next
If WindowCount > 0 Then
hs.SetDeviceValueByRef(WindowDev,100,True)
hs.SetDeviceString(WindowDev, WindowDevString,True)
Else
hs.SetDeviceValueByRef(WindowDev,0,True)
hs.SetDeviceString(WindowDev, "All Windows Closed",True)
End If
If Debug Then hs.writelog(LogName, "Window Count: " & WindowCount)
'Door
For Each Door As Integer In DoorArray
dv = hs.GetDeviceByRef(Door)
DoorName = dv.Name(hs)
If Debug Then hs.writelog(LogName, "Door " & DoorName & " | Value " & hs.DeviceValue(Door))
If hs.DeviceValue(Door) > 0 Then
DoorCount = DoorCount + 1
DoorDevString = DoorDevString & DoorName & ",<br>"
If Debug Then hs.writelog(LogName, DoorName & " Open")
End If
Next
If DoorCount > 0 Then
hs.SetDeviceValueByRef(DoorDev,100,True)
hs.SetDeviceString(DoorDev, DoorDevString,True)
Else
hs.SetDeviceValueByRef(DoorDev,0,True)
hs.SetDeviceString(DoorDev, "All Doors Closed",True)
End If
If Debug Then hs.writelog(LogName, "Door Count: " & DoorCount)
Catch ex As Exception
hs.WriteLog (LogName, "Error Door: " & ex.Message)
End Try
End Sub
Endre: Dim Debug As Boolean = True til Dim Debug As Boolean = False for å fjerne all log beskjeder.