Announcement

Collapse
No announcement yet.

Fastest way to find value in EDO.GetNamed?

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

    Fastest way to find value in EDO.GetNamed?

    Hi, do I need to loop through all devices to find the device by GetNamed info or could this be done by any direct method select to hs3 mssql database? I need optimize all steps in my project.
    PHP Code:
    Public Function GetKey(ByVal Parms As Object) As String
            Dim dv 
    As Scheduler.Classes.DeviceClass
            Dim EN 
    As Scheduler.Classes.clsDeviceEnumeration Nothing
            Dim EDO 
    As HomeSeerAPI.clsPlugExtraData Nothing
            
    Try
                
    EN hs.GetDeviceEnumerator
                
    If EN Is Nothing Then Throw New Exception("Failed to get a device enumerator from HomeSeer.")
                Do
                    
    dv EN.GetNext
                    
    If dv Is Nothing Then Continue Do
                    If 
    dv.Interface(NothingIsNot Nothing Then
                        
    If dv.Interface(Nothing).Trim "concerned interface" Then
                            EDO 
    dv.PlugExtraData_Get(Nothing)
                            If 
    EDO IsNot Nothing Then
                                Dim api_key 
    As Object Nothing
                                api_key 
    EDO.GetNamed("api_key")
                                If 
    InStr(api_key.ToStringParms.ToStringCompareMethod.Text) > 0 Then
                                    
    Return api_key.ToString
                                End 
    If
                            
    End If
                        
    End If
                    
    End If
                
    Loop Until EN.Finished
            
    Catch ex As Exception
                hs
    .WriteLog(" Error""Exception in Find_Create_Devices/Enumerator: " ex.Message)
            
    End Try

            Return 
    "Not Found"
        
    End Function 
    Please excuse any spelling and grammatical errors I may make.
    --
    Tasker Plugin / Speech Droid
    Tonlof | Sweden
Working...
X