Announcement

Collapse
No announcement yet.

Device Value's "Display Status" string access

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

    Device Value's "Display Status" string access

    Is there a way to access (via a script command) the string value "Display Status" that is associated with a particular device value?

    My plan is to use virtual device to store door lock codes (in the Value field) and the related name of the person who is assigned that code in the Display Status field and then use the association to show who unloced the zwave door lock - in HS.Touch.

    I am trying to avoid putting the assigned 'names' in script code.

    Thanks,
    Alan

    #2
    Alan - would you mind sharing a screenshot? I'm after ideas on an HSTouch interface for my lock...
    HS4Pro on a Raspberry Pi4
    54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
    Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

    HSTouch Clients: 1 Android

    Comment


      #3
      Originally posted by rmasonjr View Post
      Alan - would you mind sharing a screenshot? I'm after ideas on an HSTouch interface for my lock...
      As soon as I finish the program I'm working on (that stores the last 9 "unlocks" times and codes in virtual devices) I will complete the hs.touch screen for the doors. I'm almost there. Then I will post a screen shot.

      Comment


        #4
        See the help file for:

        SetDeviceString
        SetDeviceStringByName

        Get:
        DeviceString
        DeviceStringByName
        Mike

        Comment


          #5
          Alan,

          What you are looking for is "DeviceValuesAdd". With this command you add the device value/pairs that set the device status string based on the value of the device. You only need to execute the command once since the pairs are stored with the device info in the database.


          Ken
          "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

          Comment


            #6
            Originally posted by mwaite View Post
            See the help file for:

            SetDeviceString
            SetDeviceStringByName

            Get:
            DeviceString
            DeviceStringByName
            Mike, I'm not referring to he device string (I'm storing the 'time' in that field). I'm talking about the text values under the column heading of "Display Status". See attached image...

            Ken, I saw your post as I was typing this.
            From you comments - I can't use the device string AND the device Display Staus?

            Thanks,
            Alan
            Attached Files

            Comment


              #7
              Hi Alan,

              This is many times a source of confusion. There are three main things associated with a device; device value, device status, and device string. Depending on the device the device value and device status are linked. Device string is independent of either of these. What DeviceValuesAdd does is allows you to set the association of device value and the device "status" string but does not affect the device string.

              This should give you the same results as your screen capture without affecting device string.

              Code:
              hs.DeviceValuesAdd "A1","Alan" & chr(2) & "1" & chr(1) & _
                                      "Anne" & chr(2) & "2" & chr(1) & _
                                      "Heather" & chr(2) & "3" & chr(1) & _
                                      "Michelle" & chr(2) & "4" & chr(1) & _
                                      "Any Value" & chr(2) & "999", False
              Let me know if you can't get it working.
              Ken
              "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

              Comment


                #8
                OK,

                I just went back and re-read your first post and I was thinking about it wrong.

                What you want to do is access the device value/pairs. These are held in the "values" property of the device class.

                Code:
                sub Main()
                
                dim dvref
                dim dv
                
                dvref = hs.GetDeviceRef("A1")
                
                if dvRef > 0 then
                    dv = hs.GetDeviceByRef(dvRef)
                else
                    hs.WriteLog "Error","Could not find the reference for the device specified."
                    exit Sub
                end if
                
                ' dv.values now contains the value/status pairs as a string
                '
                ' See DeviceValuesAdd for the delimiters to parse the string
                
                
                End Sub
                "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

                Comment


                  #9
                  Originally posted by kenm View Post
                  OK,

                  I just went back and re-read your first post and I was thinking about it wrong.

                  What you want to do is access the device value/pairs. These are held in the "values" property of the device class.

                  Code:
                  sub Main()
                  
                  dim dvref
                  dim dv
                  
                  dvref = hs.GetDeviceRef("A1")
                  
                  if dvRef > 0 then
                      dv = hs.GetDeviceByRef(dvRef)
                  else
                      hs.WriteLog "Error","Could not find the reference for the device specified."
                      exit Sub
                  end if
                  
                  ' dv.values now contains the value/status pairs as a string
                  '
                  ' See DeviceValuesAdd for the delimiters to parse the string
                  
                  
                  End Sub
                  Ken,
                  Thanks for your help. However, I am not sure we are on the same page. Your example allows me to get the complete list (as in my screen capture).
                  What I'm trying to do is access (from HS.Touch) the string value associated with the integer value of the single code that is active.

                  In other words I can asscess and display the 'value' (1, 2..) but I want to display the name (Alan, Anne...).

                  Is that what you understood and are suggesting that I have to write script to match the current value to the text by searching the dv.values string?

                  Alan

                  Comment


                    #10
                    Hi Alan,

                    I don't know of any way to access this info from HS Touch directly. There might be but I just don't know.

                    I would write a function that is called based on a device value change for your lock device. What the function would do is get the device value from the lock device, parse the "values" string, and store the name associated with the device value in a virtual device called something like "last accessed by" or something similar.

                    Let me know if you need a hand writing the code.

                    Ken
                    "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

                    Comment


                      #11
                      Wait a minute...

                      Alan,

                      This can be done with a Text Box using Status Tracking. Add a Text Box to your project and click on StatusTrackingNormal in the Element Properties. Select your lock device and select the "Use Status Text" radio button. This will display the status text (in this case the name) associated with the device value. I just tested in on one of my devices and it seems to work.

                      If you only want to display this info in HS Touch then this will work, however if you need to do something with the device status string in a script you'll still need to do it the way I've outlined above.

                      Ken
                      "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

                      Comment


                        #12
                        rmasonjr,

                        Here is a screen shot of my Door Status screen for my iPhone.
                        I'm still trying to work a few kinks out...
                        Before reading Ken's latest email I switched gears I used the Device string to store the User Name via a script subroutine and also update the DeviceLastChange to the actual time of the door being unlocked (used a global array to hold the last eight times, names, value codes).

                        It works but I can't get a single Event to run the script based on 'any' user entering their code.

                        I'm going to look at Ken's idea to see if that is another way to skin this cat :-) (I really do like cats).

                        Let me know if you have any suggestions or comments.

                        Alan
                        Attached Files
                        Last edited by Alan; September 6, 2010, 11:59 AM.

                        Comment


                          #13
                          Originally posted by kenm View Post
                          Alan,

                          This can be done with a Text Box using Status Tracking. Add a Text Box to your project and click on StatusTrackingNormal in the Element Properties. Select your lock device and select the "Use Status Text" radio button. This will display the status text (in this case the name) associated with the device value. I just tested in on one of my devices and it seems to work.

                          If you only want to display this info in HS Touch then this will work, however if you need to do something with the device status string in a script you'll still need to do it the way I've outlined above.

                          Ken
                          Ken,
                          My status screen displays list of the last eight user codes entered (the screen shot above shows the same entry multiple times because I was testing the script manually). Thus, I'm forced to run a script to update the array (that moves data down the list each time the script is run).
                          I can't seem to make 'one' event run that is triggered by any user entering their unlock code. I'm stumped at this point. :-(

                          Comment

                          Working...
                          X