Announcement

Collapse
No announcement yet.

Accessing Lock Code User Name

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

    Accessing Lock Code User Name

    When setting lock codes on the Z-Wave Plugin's "Lock Management" page, I enter each code as a User Name / PIN combination.

    I'd like to be able to access the User Name in the body of emails and in the Status field displayed for the lock's Notification device.

    For the email body, is there a replacement variable that lets me access this -- sort of like I can use $$DVRref):

    For the status field, some device provide additional values use can display using an index like @%0@, @%1@, etc. Or, similarly, allow a scale to be inserted in the notification status text using @S@. Is there anything similar for the lock user name - I can't seem to find it.

    I've checked the HS3 Software Development Kit .pdf manual and found nothing (but that was last updated 3/10/2015 so it may be out of date).

    I realize there are work around such as creating separate Value / Status lines in each Lock's Access Control Notification device where I specify the User Name associated with each code, but this is fairly inflexible, particularly if I change codes so I am looking for a more "automated" way (or looking to know that a more automated way doesn't exist)

    Thanks for any help that can be provided.


    #2
    I use this script by sparkman to get usernames into the log.

    https://forums.homeseer.com/forum/de...pt?postcount=1
    HS3 SEL running Pro Edition 3.0.0.531 on Ubuntu 18.04, mono 5.20, 656 devices, 209 events.
    Plug-Ins: Chromecast, Device History, EasyTrigger, Ecobee, JowiHue, LutronCaseta, MeiUnifi, PHLocation2, Pushover 3P, SDJ-Health, Sonos, WeatherFlow, weatherXML
    Scripts: SparkMan's Lock Event, 5 of Jon00 scripts.

    Comment


      #3
      You can retrieve the pin and username for a given location using the script below. However, this only works if the codes were set in the lock using the plugin after this functionality was added to the plugin. If the pins were set using an older version, then only blank values are returned. The script expects two values to be passed to it, the z-wave Node ID of the lock and the number corresponding to the slot/location for which you want to retrieve those values, separated by the | character. So as an example if you want to retrieve the value for the first slot for Node 4, then pass 4|1 to it. One option would be to modify the script to store the info in virtual devices and then use the replacement variables in emails. The script can then be run on a regular basis using an event to ensure the values are updated.

      Code:
      Sub Main(parms As String)
          Dim logName As String = "Z-Wave Get User Code PIN"                'set log name for HS log
          Dim debug As Boolean = True
      
          Dim param as String() = parms.Split("|")
          Dim NodeID as String = param(0)
          Dim LocationID as String = param(1)
      
          Dim InterfaceID As String = hs.GetINISetting("Interfaces", "IFace_0_Unique", "", "Z-Wave.ini")
      
          Dim ConfigResult As String = ""
      
          If NodeID <> "" And LocationID <> "" Then
              Try
                  ConfigResult = hs.PluginFunction("Z-Wave", "", "GetUserCodePin",New Object(){NodeID,LocationID,InterfaceID})
                  If Debug Then hs.WriteLog(logName,ConfigResult)
              Catch ex As Exception
                  hs.writelog(logName, "Error:  " & ex.Message.ToString)
              End Try
          Else
              hs.WriteLog(logName,"No Node ID or Location specified")
          End If
      
      End Sub
      HS 3.0.0.548: 1990 Devices 1172 Events
      Z-Wave 3.0.1.262: 126 Nodes on one Z-Net

      Comment


        #4
        sparkman Is there any easy and straightforward way to have only the "User" reported with a different function call ?

        Comment


          #5
          Originally posted by goldriver View Post
          sparkman Is there any easy and straightforward way to have only the "User" reported with a different function call ?
          Not at far as I know.
          HS 3.0.0.548: 1990 Devices 1172 Events
          Z-Wave 3.0.1.262: 126 Nodes on one Z-Net

          Comment


            #6
            Originally posted by sparkman View Post

            Not at far as I know.
            Thanks for that

            would you be aware of a way I could retrieve the information if I only have the Device Reference available and not the NodeId ? (I tried to find a function to get the nodeid from the deviceref but can't find any )

            Comment


              #7
              Originally posted by goldriver View Post

              Thanks for that

              would you be aware of a way I could retrieve the information if I only have the Device Reference available and not the NodeId ? (I tried to find a function to get the nodeid from the deviceref but can't find any )
              It may be possible, but I’ve never looked to do so. Why would you not know the node-id? It’s easily obtained manually.
              HS 3.0.0.548: 1990 Devices 1172 Events
              Z-Wave 3.0.1.262: 126 Nodes on one Z-Net

              Comment


                #8
                Originally posted by sparkman View Post

                It may be possible, but I’ve never looked to do so. Why would you not know the node-id? It’s easily obtained.
                I am trying via the EasyTrigger plugin event "Any device in group doorlock has its value changed" option to send a pushover with the user that unlock ANY of the door. I can actually get the device ref returned by the plugin but the easytrigger plugin does not provide the nodeid.

                Comment


                  #9
                  Originally posted by goldriver View Post

                  I am trying via the EasyTrigger plugin event "Any device in group doorlock has its value changed" option to send a pushover with the user that unlock ANY of the door. I can actually get the device ref returned by the plugin but the easytrigger plugin does not provide the nodeid.
                  Don't really know of any way to do so. The address of the device contains the node number, but no easy way to get the address from the reference id based on the functions I see available in the manual. You could just use the script referenced in the second post of this thread, but you'd need one event per lock.


                  EDIT: looks like you can get the address this way: http://help.homeseer.com/help/HS3/st...s_deviceclass1
                  HS 3.0.0.548: 1990 Devices 1172 Events
                  Z-Wave 3.0.1.262: 126 Nodes on one Z-Net

                  Comment


                    #10
                    Originally posted by sparkman View Post

                    Don't really know of any way to do so. The address of the device contains the node number, but no easy way to get the address from the reference id based on the functions I see available in the manual. You could just use the script referenced in the second post of this thread, but you'd need one event per lock.
                    Thanks for the help, actually I was already using many event to manage my notifications, I was just trying to do a better management of all my events... I have so may.

                    thanks again and take care with everything going on

                    Comment


                      #11
                      goldriver Here's a quick script that retrieves the address from the reference ID. The address would need to be parsed to get the node id from it.

                      ​​​​​​​
                      Code:
                      Dim DV As Integer = 1012
                      
                      Dim rDV As Scheduler.Classes.DeviceClass
                      
                      Sub Main(ByVal Parm As Object)
                      
                          If hs.deviceexistsref(DV) Then
                              rDV = hs.GetDeviceByRef(DV)
                              hs.writelog("Address", & rDV.Address(hs))
                          Else
                              hs.writelog("Address", "Device Reference " & DV & " does not exist")
                          End If
                      
                      End Sub
                      HS 3.0.0.548: 1990 Devices 1172 Events
                      Z-Wave 3.0.1.262: 126 Nodes on one Z-Net

                      Comment

                      Working...
                      X