Announcement

Collapse
No announcement yet.

Error in script: VB.Net script exception

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

  • Error in script: VB.Net script exception

    I am getting this error in my log every time the script runs, and I do not know what it could be


    VB.Net script exception(0), re-starting: Object reference not set to an instance of an object


    Code:
    dim array_windows() as string = {"Bedroom Right Window","Bedroom Left Window"}
    
    dim windows_count as integer = 0
    dim window_name as string = ""
    dim wstr as string = ""
     
    sub main(ByVal Parms as Object)
    Try
    windows_count = 0
    window_name = ""
    wstr = ""
     for each devw as string in array_windows
        if hs.DeviceValueByName(devw) = 255 or hs.DeviceValueByName(devw) = 100 then
            windows_count = windows_count + 1
            window_name = devw
            'wstr = wstr & window_name & " Opened" & "<br>"
        
        end if
    next
        If windows_count > 0 then 
            
          hs.TriggerEvent("TTS close the bedroom windows")
          hs.TriggerEvent("AC close bedroom windows")
    
        End If
        
        hs.writelog("Array", "Window Count: " & windows_count)
     Catch ex As Exception
    hs.WriteLog ("Array", "Error: " & ex.Message)
    End Try
    End Sub



  • #2
    try putting sub main line as first line in code

    Comment


    • #3
      I did move it, but still throwing the same error

      I think I found it. Running without errors now
      Last edited by mikee123; June 28th, 2018, 04:27 PM.

      Comment


      • #4
        Meaning?

        Comment

        Working...
        X