Yes, you can change codes in Habmin and through the REST API, which can also be done in a rule.
You won’t need a rule triggered on alarm_raw to update the lock’s state, but you will everything else in there… like identifying who has unlocked the lock.