No announcement yet.

Accessing Lock Code User Name

  • 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.
    HS3 SEL running Pro Edition 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.


    • #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.

      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
                  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
              hs.WriteLog(logName,"No Node ID or Location specified")
          End If
      End Sub
      HS 1990 Devices 1172 Events
      Z-Wave 126 Nodes on one Z-Net