Announcement

Collapse
No announcement yet.

2 housecodes in one plugin

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

    2 housecodes in one plugin

    i have 2 housecodes in my plugin , gbasecode and gbasecode2

    they are retrieved from homeseer the first one issued is: ' the second is #.

    but retrieving them with enumerating devices of plugin gives first # and as second '

    is that normal behavior of the homeseer device enumerator ?

    #2
    House code are allocated in ascii sort order. I do not believe there is any guaranteed order for device enumeration. If you need an order then you need to sort the returned set.

    Comment


      #3
      okay thank you , why dont i see the obvious ?

      device enumeration is still a black box in homeseer

      i made next code, it seems a complete at random enumeration of the existing devices, the code can be tried in tenscripting.

      Code:
      Public Sub enumeratedevicecode(ByVal parms As Object)
      
              '' [url]http://msdn.microsoft.com/en-us/library/xfhwa508[/url]
      
              Dim DE As Object = hs.GetDeviceEnumerator()
              'Dim dv As Object
              Dim dev_code As Short  'th deviccode
      
            
              Dim devicecodes As New List(Of Integer)
              Dim dict As New Dictionary(Of Char, List(Of Short))
      
      
              Dim b As Object
              Dim i As Integer = 0   '' count housecode
              Dim ii As Integer = 0  '' count devices per housecode
              Dim iii As Integer = 0  '' count total amount of devices
              'Dim anHsDevice As Scheduler.Classes.DeviceClass
              'Dim hsDevices As Scheduler.clsDeviceEnumeration
      
      
      
              Dim dv As Scheduler.Classes.DeviceClass
      
              Dim a As Object
      
      
      
      
      
      
      
      
              dev_code = 0    ''   enumerate rts485 devices
              Do While Not DE.Finished
      
      
      
                  dv = DE.GetNext
                  If Not dv Is Nothing Then
                      a = dv.hc     '' housecode of device
                      b = dv.dc     '' devicecode of device
                      'If iii = 0 Then                    '' first device ever
      
                      '    Dim arr As New List(Of Short)       ''  (list of devcecodes) = value belonging to housecode (key)
                      '    arr.Add(b)
                      '    dict.Add(a, arr)
      
                      'End If
      
                      If Not dict.ContainsKey(a) Then   ''  If housecodes is Not contained already in dictionary then add housecode as key and a new list
      
                          Dim arr As New List(Of Short)
                          arr.Add(b)
                          dict.Add(a, arr)
                      Else
      
      
                          dict.Item(a).Add(b)   '' ads devicecode to list if that housecodekey
      
      
                      End If
      
      
      
      
      
      
      
      
                  End If
      
                  devicecodes.Add(dv.ref)
                  iii = iii + 1
              Loop
      
      
      
      
      
          End Sub
      Last edited by wetlip; June 1, 2012, 02:10 AM.

      Comment


        #4
        in the tools of homeseer the code list i get this list where "# " is put on top
        Attached Files

        Comment


          #5
          I believe that if nothing else is defined, the default sorting is done on Device ID, an "randomly generated" integer.
          HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
          Running on Windows 10 (64) virtualized
          on ESXi (Fujitsu Primergy TX150 S8).
          WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

          Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

          Comment

          Working...
          X