update..spent some time tonight figuring this out...and finally got it.
I got the proper "unlocked" events now from the subscription. Not sure what I missed the first time but I AM only getting unlocked events now with this:
subscribe(lock, "lock.unlocked", lockHandler)
Second, I do NOT get an evt.type I'm guessing this is a driver thing...so that part needed to be removed. My if statement looks like this:
if (evt.descriptionText.endsWith('thumbturn [physical]') || evt.descriptionText.endsWith('command [digital]')) {
infolog "$lock.displayName was unlocked manually"
} else {
infolog "$lock.displayName was unlocked by CODE: $lastName"
sendPushMessage.deviceNotification("$lock.displayName was unlocked by: $lastName")
}
Notice "thumbturn" in my case did NOT have a space like yours did. But updating this here for others in the future. Is there not a more standard way to handle these events for ALL locks? At least the digital/physical/thumbturn/code entered parts? Understand some locks will have different capabilities... either way...got it finally worked out now and FINALLY have a way to notify when a door gets unlocked ONLY by a code.