Run an automation based on a code entered on a door lock

I’m looking to get a smart deadbolt lock that integrates with HA. I’d like to be able to assign codes to different people and have different automations based on which codes are used to open the door. For example, my house cleaner would have a code, when it’s entered HA would turn on all the lights and send me a notification. When my wife uses her code to unlock the door HA could turn on some music, or different lights.

Can this be done with HA? If so, do I need to buy a specific lock?

1 Like

I know the Zwave locks have sensors and attributes that will say which user code unlocked the lock. I don’t remember off the top of my head, but it’s something like sensor.lock_access_control. the sensor gives a value, so in an automation you would trigger on the sensor, then in the actions section setup conditions with associated actions based on the value of the access control sensor.

Did you ever figure this out? I have Kwikset Z-Wave locks and I’m trying to trigger automations based on PIN codes enter on lock.

use a zwave_js_notification event trigger in an automation. If you go to your developer tools and subscribe to that event you will see an event happen when you lock/unlock from the keypad. There’s many attributes you can use, but specifically you will see things like the node number that fired the event, the type and event numbers, and an event label. I believe what you are looking for would be the 'userId' attribute. one of my automations has a trigger that looks for a keypad unlock. It doesn’t care which access code, only just that it was a keypad event. You can take this and add the 'userId' attribute to the trigger. Also see here and here for more info.

your event trigger would look something like this:

      - platform: event
        event_type: zwave_js_notification
        event_data:
          node_id: 80
          type: 6
          event: 6
          event_label: Keypad unlock operation
          parameters:
            userID: 1