SmartThings Community

[RELEASE] Lock Manager

(Stephen Johnson) #2132

After updating the device handler it took about a day before I started getting notifications.

Works like it used to again!


This sucks, I just can’t get it to work.


How many device handlers do you have listed?

(Stephen Johnson) #2135

Not sure I get what you mean. There are several lock device handlers in the list and I have a Yale lock so I published and assigned ethayer’s Yale lock device handler to the lock - I was using the ‘with codes’ version before. Went into the device handler code and made the change described earlier in the thread and after about 12 - 24 hours I started getting notifications about lock activity.

I should mention that the lock manager smartapp was dead for me - just took errors when I tried to change anything - so I removed and reinstalled it from scratch. I let it do the full sweep to clear all codes and added them back. I only have a couple of codes so it wasn’t a big deal.


Patch working great. Thanks!


This is what I have

I first updated the code to ethayers and was not getting any notifications. Last night I updated the code with the patch to the smartthings device and started to get notifications today. Interestingly enough it was gradual, first started to get manual lock/unlock, and then started getting notifications from my users. Funny thing is I am getting error codes on all of my users.


Here you go, based on this documentation:

private getCommandClassVersions() {
        0x62: 1,  // Door Lock
        0x63: 1,  // User Code
        0x71: 2,  // Notification (v3)
        0x72: 2,  // ManufacturerSpecific
        0x80: 1,  // Battery
        0x85: 2,  // Association
        0x86: 1,  // Version (v2)
        0x98: 1,  // Security

After 3 years on Version 1.4, I recently upgraded to the current 2.0 version successfully with my Yale lock. I did not get notifications until I made the change to the DTH (I am using ethayer’s Z-Wave Lock Yale) mentioned in post 2053 by Kianoosh_Karami.

I made three changes to Lock Manager to make it work the way I wanted. The diff for all the changes I made is at the end of this post, but first I will describe the changes.

  1. If the Master Code is used, the Yale lock indicates that it was opened with code 0. I was not getting a notification in this case because Lock Manager did not recognize this use case even though the DTH recognized it. Lock Manager was telling me in a debug message that “Lock was locked by unknown user!” (see line 1179). (This was incorrect in itself since this message was generated after it was determined that the state of the lock was unlocked.) I added code to check if code 0 was used, and, if so, to send a notification that the Master Code was used. If it was not code 0, then the original debug message, corrected to be “unlocked”, would be issued.

  2. No notification was given if the lock was unlocked manually because there was no code in that section to do so, even though there was code if the lock was locked manually (see line 1272). I added the statements to provide notification.

  3. No notifications were given if the lock was locked or unlocked via a SmartThings command. The routine for handling these cases was left empty as shown by the comments (see line 1277). I added code to provide appropriate notifications for this.

Here is the diff from the current Lock Manager code to my version:

< debugger(‘Lock was locked by unknown user!’)

  if (data.usedCode == 0) {
    // Yale locks have code 0 for the Master Code
    message = "${lock.label} was unlocked by Master Code"
    if (codeUnlockRoutine) {
    if (parent.notifyAccess) {
    if (parent.alexaAccess) {
  } else {
  debugger('Lock was unlocked by unknown user!')




if (notifyManualUnlock) {
if (alexaManualUnlock) {

< // no options for this scenario yet

def message
if (evt.value == ‘locked’) {
// locked by command
message = “${lock.label} was locked by command”

if (notifyManualLock) {
if (alexaManualLock) {

} else if (evt.value == ‘unlocked’) {
message = “${lock.label} was unlocked by command”

if (notifyManualUnlock) {
if (alexaManualUnlock) {


(Chris) #2141

Hi All,
I have a problem with my LockManger. Started a week back or so where it quit writing codes or being able to update/save codes. I uninstalled everything reinstalled what I could (couldn’t find the child apps based on the instructions or in github) On the main app it show the user setup, shows the schedule, but wrote the code to the lock 9 hours later. Orig set the code to be written at 3:30pm and it was written at 12:26am.![Screenshot_20190524-091923_SmartThings|281x500]

Any help is GREATLY appreciated!!!