Announcement

Collapse
No announcement yet.

Script what Am I doing wrong

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

  • Script what Am I doing wrong

    I'm trying to cycle thru the list of devices and if any of these conditions are right, then check to see if time is great then .... How do I write this statement?

    For Each hs.getDeviceByRef(Nothing) As Integer In ListOfDevices

    PHP Code:
           Dim ListOfDevices() As Integer = {215246509}

        
    '215 - Category: Sprinkler - Acual Rain Prior 1 Day
        '
    216 CategorySprinkler Average Wind for 20 Min 

            
    Try
                
    Dim dv As Scheduler.Classes.DeviceClass
                Dim EN 
    As Scheduler.Classes.clsDeviceEnumeration
                EN 
    hs.GetDeviceEnumerator
                
    If EN Is Nothing Then
                    hs
    .WriteLog("BatteryReport""Error getting Enumerator")
                    Exit 
    Sub
                End 
    If

                Do
                    
    dv EN.GetNext
                    
    If dv Is Nothing Then Continue Do

        
    '        For Each Device As Integer In ListOfDevices
                For Each hs.getDeviceByRef(Nothing) As Integer In ListOfDevices
                            '
    If InStr(UCase(dv.Device_Type_String(Nothing)), "BATTERY") > 1 Then



        
    If hs.DeviceTime(Device) > 1440 Then


                     ReDim Preserve myArray
    (UBound(myArray) + 1)
                        
    myArray(UBound(myArray) - 1) = New BatteryDevice
                        myArray
    (UBound(myArray) - 1).refID = ("[" dv.Ref(Nothing).ToString "]")
                        
    myArray(UBound(myArray) - 1).devValue = (dv.devValue(Nothing).ToString " ").PadLeft(7)
                        
    myArray(UBound(myArray) - 1).devName dv.Location2(Nothing) & " " dv.Location(Nothing) & " " dv.Name(Nothing)
                        
    myArray(UBound(myArray) - 1).lastChange dv.Last_Change(Nothing).ToString

    '                End If
             End If
            Next

            Loop Until EN.Finished 
Working...
X