Detect which pin code has been used to open the door


I’m looking into creating an automation that can trigger specific scenes based on who has unlocked the door.

The use case is: triggering a specific scene when the housekeeper comes in or a different scene for when guests are walking in.

Each guest / housekeeper will have a specific pincode. I can save the IDs of the codes on my database. If I’ve read the docs correctly, I can setup a webhook to notify my system when the door is unlocked.

Question is: how can I determine (quickly) what code has been used? Would latency be a problem? (I don’t want to take several seconds for the scene to trigger; imagine walking in and lights turning on 30-60 seconds later…that’s not a good experience).

Thank you!


please check out our documentation on Webhooks

To determine who unlocked the door you can use the Device Logs and Device Status.

I recommend to read through the whole Web API and Webhook documentation.


Brilliant, I’ve got it now. Examples are a bit random so it is very difficult to puzzle what’s going on.

This is what I think is the right solution:

  • SmartlockAuth will tell me what code is what (so I can save the IDs for the different codes and link them with the difference scenes)
  • SmartlockLog authId = the SmartlockAuth id, action = 1, trigger = 255 will tell me that the pincode has been used on the keypad to unlock the door

The last question remains: what kind of latency should I be expecting between the lock unlocking and the web hook been delivered?

1 Like

Did you manage to get this working?

Trying the same, TIA

I did manage to get it to work.

The MQTT topic lockActionEvent follows the format lockAction,trigger,authId,codeId

Get the ID of the event: if codeId is 0, use authId, otherwise you can read codeId (authId is used by all events but keypad events where codeId is used instead)

To get the auth details, you have to query{smartLockId}/auth; the API response will contain the authId == id from MQTT event

I hope that’s clear