BOOM! Exactly what I was looking for.
I tried something like this in the past and aborted the project because:
- User codes in their code, the door unlocks, the user code is passed - BINGO
- Another user manually opens the lock from inside...the last code that was used to unlock the door is passed...wrong user
I could not find a way to differentiate between an unlock event from the keypad or an unlock event by manually turning the knob.