Søk i nettsamfunnet
Viser resultater for emneknaggene 'set string'.
Fant 1 resultat
-
Jeg ønsker å få til en virtuell device for alle vinduer, og en for dørene. Denne skal oppdateres med hvilke vinduer/dører som er åpne til en hver tid. Eventuelt om alle er lukket. Scripting er jeg ganske fersk med, så det har blitt litt copy paste fra her inne samt homeseer forumet. Fant et script som skal gjøre akkurat det jeg trenger, men jeg får warning i loggen : VB.Net script exception(0), re-starting: Object reference not set to an instance of an object Noen som har noen tips, er det noe åpenbart jeg har misset her? Til info så har jeg oppdatert scriptet med mine devicer Jeg kjører forøvrig HS3 på Raspbian. ' these are the virtual devices to be updated by the script '423 Windows '424 Doors 'Use the reference ID of the door or window sensor devices in the arrays below Public Sub Main(ByVal Parms as Object) Dim array_windows() as string = {"221", "217", "215", "213", "211"} Dim array_doors() as string = {"219", "209"} Dim windows_count as integer = 0 Dim window_name as string = "" Dim wstr as string = "" Dim doors_count as integer = 0 Dim door_name as String = "" Dim dstr as string = "" Dim dv as Object End Sub 'Using 2 subs, one for doors and the other for windows 'WINDOWS Sub windows(ByVal Parms as Object) Try windows_count = 0 window_name = "" wstr = "" for each devw as string in array_windows 'hs.writelog("Array", "Window " & window_name & " | Value " & hs.DeviceValue(devw)) if hs.DeviceValue(devw) = 1 then windows_count = windows_count + 1 dv = hs.GetDeviceByRef(devw) window_name = dv.Name(hs) wstr = wstr & window_name & ",<br>" hs.writelog("DoorWindow", window_name & " Open") 'hs.writelog("DoorWindow", array_windows) end if next If windows_count > 0 then hs.SetDeviceValueByRef(423,100,true) hs.SetDeviceString(423, wstr,true) Else hs.SetDeviceValueByRef(423,0,true) hs.SetDeviceString(423, "Alle vinduer lukket",true) End If hs.writelog("DoorWindow", "Window Count: " & windows_count) Catch ex As Exception hs.WriteLog ("DoorWindow", "Error: " & ex.Message) End Try End Sub 'DOORS Sub doors(ByVal Parms as Object) Try doors_count = 0 door_name = "" dstr = "" for each devd as string in array_doors 'hs.writelog("Array", "Door " & door_name & " | Value " & hs.DeviceValue(devd)) if hs.DeviceValue(devd) = 1 then dv = hs.GetDeviceByRef(devd) door_name = dv.Name(hs) doors_count = doors_count + 1 dstr = dstr & door_name & ",<br>" hs.writelog("DoorWindow", door_name & " Open") end if next If doors_count > 0 then hs.SetDeviceValueByRef(424,100,true) hs.SetDeviceString(424, dstr,true) Else hs.SetDeviceValueByRef(424,0,true) hs.SetDeviceString(424, "Alle dører lukket",true) End If hs.writelog("DoorWindow", "Door Count: " & doors_count) Catch ex As Exception hs.WriteLog ("DoorWindow", "Error: " & ex.Message) End Try End Sub
- 4 svar
-
- set string
- virtual device
-
(og 2 andre)
Merket med: