Announcement

Collapse
No announcement yet.

"Address" sorting in Device List issue

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

    "Address" sorting in Device List issue

    Sorting of devices by "Address" in the device list should sort the devices in increasing device code order. Currently it sort them as

    APCUPSD 1-Q1
    APCUPSD 1-Q11
    APCUPSD 1-Q12
    ...
    APCUPSD 1-Q2
    ...

    while I had hoped it would sort them as follows

    APCUPSD 1-Q1
    APCUPSD 1-Q2
    ..
    APCUPSD 1-Q10
    APCUPSD 1-Q11
    ...

    I tried to insert a zero after the letter if the string returned by GetNextVirtualCode is two characters (Q1 -> Q01), but as side effect subsequent GetNextVirtualCode will return the same initial code Q1).

    #2
    There is likely nothing that can be done about this because the Address and Code are both just free form text fields. There is no context that a Code should have a certain number of numeric digits.

    If you want to use the code for a specific purpose and want it to be in ascii sort order then you will need to adopt a convention where the code is of a fixed length. If that causes you problems internally then you need to remove the leading zeros behind the scenes.

    Comment


      #3
      Maybe not ideal, but GetNextVirtualCode could always return a letter and two digits adding a leading zero if between 1 and 9 (actually might need two since they now can go up to 999). What I really try to achieve is add a tag to the devices I create so that I can sort them in a predefined order like we could with HS2.

      Agree I can create my own codes instead of using GetNextVirtualCode; I wanted to point it especially with HS3 still under development.

      Comment


        #4
        This is where it would have been really handy to have subdevices as was discussed early on. Even if it was just for display purposes it would be a big benefit. For instance, I could have all the various devices pertaining to a thermostat display underneath the root device, possibly even with a slider control to expand or shrink the list. I just added four thermostats with their associated devices, and the devices page is a mess. I use the same address for every device related to a specific thermostat which helps in sorting a little. I guess I could also add a code just for sorting (i.e. cooling setpoint is always "1", heating always "2" etc). But I really would like to stay away from codes at all.
        HS Pro 3.0 | Linux Ubuntu 16.04 x64 virtualized under Proxmox (KVM)
        Hardware: Z-NET - W800 Serial - Digi PortServer TS/8 and TS/16 serial to Ethernet - Insteon PLM - RFXCOM - X10 Wireless
        Plugins: HSTouch iOS and Android, RFXCOM, BlueIris, BLLock, BLDSC, BLRF, Insteon PLM (MNSandler), Device History, Ecobee, BLRing, Kodi, UltraWeatherWU3
        Second home: Zee S2 with Z-Wave, CT101 Z-Wave Thermostat, Aeotec Z-Wave microswitches, HSM200 occupancy sensor, Ecolink Z-Wave door sensors, STI Driveway Monitor interfaced to Zee S2 GPIO pins.

        Comment


          #5
          You can do what you want by inserting the zeros into the code field to always make it 2 or 3 (or more) digits. You DO however have to remember that for calls that get a device by code (or address and code) that take a string input, that you have to put the leading zeros in.

          So if your code is "A" and the value in variable DC, then you need to always refer to it as "A" & DC.ToString("00") (Which, off the top of my head, is the way to tell it two characters with leading zeros.)

          If it takes a numerical argument, then odds are good that it will take everything after the first letter and will convert it into a number, so the leading zeros should not cause a problem. HOWEVER, there are some conversion methods such as CInt that may not like the leading zeros, but CInt(Val()) would likely work, and the better Convert.ToInt32 should be OK with it. That said, there probably are places in the software where it not only is converting it wrong, but may even be getting only 2 characters (so 2 leading zeros would cause a problem). If you have a device in which a call does not seem to be working, give me what the address and code appear as, how you are calling it, and I will make sure it works as it should.
          Regards,

          Rick Tinker (a.k.a. "Tink")

          Comment

          Working...
          X