diff --git a/devicetypes/smartthings/zwave-lock.src/zwave-lock.groovy b/devicetypes/smartthings/zwave-lock.src/zwave-lock.groovy index 981e11a7971..ac8b9405210 100644 --- a/devicetypes/smartthings/zwave-lock.src/zwave-lock.groovy +++ b/devicetypes/smartthings/zwave-lock.src/zwave-lock.groovy @@ -52,6 +52,7 @@ metadata { fingerprint mfr:"0129", prod:"0007", model:"0001", deviceJoinName: "Yale Keyless Connected Smart Door Lock" fingerprint mfr:"0129", prod:"8004", model:"0600", deviceJoinName: "Yale Assure Lock Push Button Deadbolt" //YRD216 fingerprint mfr:"0129", prod:"6600", model:"0002", deviceJoinName: "Yale Conexis Lock" + fingerprint mfr:"0129", prod:"0001", model:"0409", deviceJoinName: "Yale Touchscreen Lever Door Lock" // YRL-220-ZW-605 // Samsung fingerprint mfr:"022E", prod:"0001", model:"0001", deviceJoinName: "Samsung Digital Lock" // SHP-DS705, SHP-DHP728, SHP-DHP525 } @@ -232,7 +233,7 @@ def parse(String description) { name: "secureInclusion", value: "failed", displayed: true, - ) + ) } } else { def cmd = zwave.parse(description, [ 0x98: 1, 0x72: 2, 0x85: 2, 0x86: 1 ]) @@ -264,8 +265,8 @@ def zwaveEvent(physicalgraph.zwave.commands.configurationv2.ConfigurationReport log.trace "[DTH] Executing 'ConfigurationReport' for device $deviceName - all codes deleted" result = allCodesDeletedEvent() result << createEvent(name: "codeChanged", value: "all deleted", descriptionText: "Deleted all user codes", - isStateChange: true, data: [lockName: deviceName, notify: true, - notificationText: "Deleted all user codes in $deviceName at ${location.name}"]) + isStateChange: true, data: [lockName: deviceName, notify: true, + notificationText: "Deleted all user codes in $deviceName at ${location.name}"]) result << createEvent(name: "lockCodes", value: util.toJson([:]), displayed: false, descriptionText: "'lockCodes' attribute updated") } result << createEvent(name:"codeLength", value: length, descriptionText: "Code length is $length", displayed: false) @@ -359,7 +360,7 @@ def zwaveEvent(DoorLockOperationReport cmd) { if (generatesDoorLockOperationReportBeforeAlarmReport()) { // we're expecting lock events to come after notification events, but for specific yale locks they come out of order runIn(3, "delayLockEvent", [data: [map: map]]) - return [:] + return [:] } else { return result ? [createEvent(map), *result] : createEvent(map) } @@ -515,7 +516,7 @@ private def handleAccessAlarmReport(cmd) { codeID = readCodeSlotId(cmd) clearStateForSlot(codeID) map = [ name: "codeChanged", value: "$codeID failed", descriptionText: "User code is duplicate and not added", - isStateChange: true, data: [isCodeDuplicate: true] ] + isStateChange: true, data: [isCodeDuplicate: true] ] } break case 0x10: // Tamper Alarm @@ -718,7 +719,7 @@ private def handleAlarmReportUsingAlarmType(cmd) { codeName = getCodeNameFromState(lockCodes, codeID) def changeType = getChangeType(lockCodes, codeID) map = [ name: "codeChanged", value: "$codeID $changeType", descriptionText: - "${getStatusForDescription(changeType)} \"$codeName\"", isStateChange: true ] + "${getStatusForDescription(changeType)} \"$codeName\"", isStateChange: true ] map.data = [ codeName: codeName, notify: true, notificationText: "${getStatusForDescription(changeType)} \"$codeName\" in $deviceName at ${location.name}" ] if(!isMasterCode(codeID)) { result << codeSetEvent(lockCodes, codeID, codeName) @@ -732,7 +733,7 @@ private def handleAlarmReportUsingAlarmType(cmd) { codeID = readCodeSlotId(cmd) clearStateForSlot(codeID) map = [ name: "codeChanged", value: "$codeID failed", descriptionText: "User code is duplicate and not added", - isStateChange: true, data: [isCodeDuplicate: true] ] + isStateChange: true, data: [isCodeDuplicate: true] ] break case 130: // Batteries replaced map = [ descriptionText: "Batteries replaced", isStateChange: true ] @@ -797,7 +798,7 @@ def zwaveEvent(UserCodeReport cmd) { def userIdStatus = cmd.userIdStatus if (userIdStatus == UserCodeReport.USER_ID_STATUS_OCCUPIED || - (userIdStatus == UserCodeReport.USER_ID_STATUS_STATUS_NOT_AVAILABLE && cmd.user)) { + (userIdStatus == UserCodeReport.USER_ID_STATUS_STATUS_NOT_AVAILABLE && cmd.user)) { def codeName @@ -839,7 +840,7 @@ def zwaveEvent(UserCodeReport cmd) { // It should be OK to mark this as duplicate pin code error since in case the batteries are down, or lock is not in range, // or wireless interference is there, the UserCodeReport will anyway not be received. map = [ name: "codeChanged", value: "$codeID failed", descriptionText: "User code is not added", isStateChange: true, - data: [ lockName: deviceName, isCodeDuplicate: true] ] + data: [ lockName: deviceName, isCodeDuplicate: true] ] } else { // We are using userIdStatus here because codeID = 0 is reported when user tries to set programming code as the user code if (codeID == "0" && userIdStatus == UserCodeReport.USER_ID_STATUS_AVAILABLE_NOT_SET && isSchlageLock()) { @@ -847,8 +848,8 @@ def zwaveEvent(UserCodeReport cmd) { log.trace "[DTH] All user codes deleted for Schlage lock" result << allCodesDeletedEvent() map = [ name: "codeChanged", value: "all deleted", descriptionText: "Deleted all user codes", isStateChange: true, - data: [ lockName: deviceName, notify: true, - notificationText: "Deleted all user codes in $deviceName at ${location.name}"] ] + data: [ lockName: deviceName, notify: true, + notificationText: "Deleted all user codes in $deviceName at ${location.name}"] ] lockCodes = [:] result << lockCodesEvent(lockCodes) } else { @@ -958,9 +959,9 @@ def zwaveEvent(physicalgraph.zwave.commands.timev1.TimeGet cmd) { if(location.timeZone) now.timeZone = location.timeZone result << createEvent(descriptionText: "Requested time update", displayed: false) result << response(secure(zwave.timeV1.timeReport( - hourLocalTime: now.get(Calendar.HOUR_OF_DAY), - minuteLocalTime: now.get(Calendar.MINUTE), - secondLocalTime: now.get(Calendar.SECOND))) + hourLocalTime: now.get(Calendar.HOUR_OF_DAY), + minuteLocalTime: now.get(Calendar.MINUTE), + secondLocalTime: now.get(Calendar.SECOND))) ) result } @@ -1054,8 +1055,8 @@ def zwaveEvent(physicalgraph.zwave.commands.versionv1.VersionReport cmd) { def zwaveEvent(physicalgraph.zwave.commands.applicationstatusv1.ApplicationBusy cmd) { log.trace "[DTH] Executing 'zwaveEvent(physicalgraph.zwave.commands.applicationstatusv1.ApplicationBusy)' with cmd = $cmd" def msg = cmd.status == 0 ? "try again later" : - cmd.status == 1 ? "try again in ${cmd.waitTime} seconds" : - cmd.status == 2 ? "request queued" : "sorry" + cmd.status == 1 ? "try again in ${cmd.waitTime} seconds" : + cmd.status == 2 ? "request queued" : "sorry" createEvent(displayed: true, descriptionText: "Is busy, $msg") } @@ -1090,8 +1091,8 @@ def zwaveEvent(physicalgraph.zwave.Command cmd) { */ def lockAndCheck(doorLockMode) { secureSequence([ - zwave.doorLockV1.doorLockOperationSet(doorLockMode: doorLockMode), - zwave.doorLockV1.doorLockOperationGet() + zwave.doorLockV1.doorLockOperationSet(doorLockMode: doorLockMode), + zwave.doorLockV1.doorLockOperationGet() ], 4200) } @@ -1384,7 +1385,7 @@ void nameSlot(codeSlot, codeName) { lockCodes[codeSlot] = newCodeName sendEvent(lockCodesEvent(lockCodes)) sendEvent(name: "codeChanged", value: "$codeSlot renamed", data: [ lockName: deviceName, notify: false, notificationText: "Renamed \"$oldCodeName\" to \"$newCodeName\" in $deviceName at ${location.name}" ], - descriptionText: "Renamed \"$oldCodeName\" to \"$newCodeName\"", displayed: true, isStateChange: true) + descriptionText: "Renamed \"$oldCodeName\" to \"$newCodeName\"", displayed: true, isStateChange: true) } /** @@ -1399,8 +1400,8 @@ def deleteCode(codeID) { // Calling user code get when deleting a code because some Kwikset locks do not generate // AlarmReport when a code is deleted manually on the lock secureSequence([ - zwave.userCodeV1.userCodeSet(userIdentifier:codeID, userIdStatus:0), - zwave.userCodeV1.userCodeGet(userIdentifier:codeID) + zwave.userCodeV1.userCodeSet(userIdentifier:codeID, userIdStatus:0), + zwave.userCodeV1.userCodeGet(userIdentifier:codeID) ], 4200) } @@ -1526,7 +1527,7 @@ private Map loadLockCodes() { */ private Map lockCodesEvent(lockCodes) { createEvent(name: "lockCodes", value: util.toJson(lockCodes), displayed: false, - descriptionText: "'lockCodes' attribute updated") + descriptionText: "'lockCodes' attribute updated") } /** @@ -1597,13 +1598,13 @@ private def allCodesDeletedEvent() { def deviceName = device.displayName lockCodes.each { id, code -> result << createEvent(name: "codeReport", value: id, data: [ code: "" ], descriptionText: "code $id was deleted", - displayed: false, isStateChange: true) + displayed: false, isStateChange: true) def codeName = code result << createEvent(name: "codeChanged", value: "$id deleted", data: [ codeName: codeName, lockName: deviceName, - notify: true, notificationText: "Deleted \"$codeName\" in $deviceName at ${location.name}" ], - descriptionText: "Deleted \"$codeName\"", - displayed: true, isStateChange: true) + notify: true, notificationText: "Deleted \"$codeName\" in $deviceName at ${location.name}" ], + descriptionText: "Deleted \"$codeName\"", + displayed: true, isStateChange: true) clearStateForSlot(id) } result @@ -1658,7 +1659,7 @@ def clearStateForSlot(codeID) { */ def getSchlageLockParam() { def map = [ - codeLength: [ number: 16, size: 1] + codeLength: [ number: 16, size: 1] ] map } @@ -1731,14 +1732,14 @@ def generatesDoorLockOperationReportBeforeAlarmReport() { //Fix for ICP-2367, ICP-2366 if(isYaleLock() && (("0007" == zwaveInfo.prod && "0001" == zwaveInfo.model) || - ("6600" == zwaveInfo.prod && "0002" == zwaveInfo.model) )) { + ("6600" == zwaveInfo.prod && "0002" == zwaveInfo.model) )) { //Yale Keyless Connected Smart Door Lock and Conexis return true } return false } - /** +/** * Generic function for reading code Slot ID from AlarmReport command * @param cmd: The AlarmReport command * @return user code slot id