-
-
Notifications
You must be signed in to change notification settings - Fork 14
ZHA integration
Lock Code Manager supports Zigbee locks connected through the ZHA integration.
Lock Code Manager communicates directly with the lock's zigpy DoorLock cluster through ZHA. PIN codes are read, set, and cleared using the standard ZCL DoorLock cluster commands (get_pin_code, set_pin_code, clear_pin_code).
PIN codes are readable on most Zigbee locks — the lock returns the actual PIN value, not a masked placeholder. This enables full sync verification without relying on optimistic updates.
- ZHA integration set up and running in Home Assistant
- A Zigbee lock that supports PIN codes (e.g., Kwikset 914, Yale YRD256, or similar models with the DoorLock cluster)
- The lock entity must appear as
lock.*from thezhaintegration in Home Assistant
| Operation | Supported | Notes |
|---|---|---|
| Set PIN | Yes | Via zigpy set_pin_code cluster command |
| Clear PIN | Yes | Via zigpy clear_pin_code cluster command |
| Read PIN | Yes | Via zigpy get_pin_code — actual PINs returned |
| Push updates | Yes | Via zigpy cluster listeners for operation and programming events |
| Code slot events | Yes | Lock/unlock with user identification via operation event notifications |
Lock Code Manager subscribes to the DoorLock cluster as a zigpy listener and receives two types of events:
-
Operation event notifications (
0x20): Fired when the lock is locked or unlocked, including the source (keypad, RF, manual) and user ID. These are mapped to Lock Code Manager code slot events for automations. -
Programming event notifications (
0x21): Fired when a PIN code is added, modified, or deleted on the lock. These trigger a coordinator refresh to pick up the change.
Not all locks support programming event notifications. Lock Code Manager automatically detects support by reading the lock's event mask attributes (keypad_programming_event_mask, rf_programming_event_mask, rfid_programming_event_mask). If no mask attributes have non-zero values, Lock Code Manager falls back to hourly drift detection polling to catch out-of-band changes.
-
No user names: The ZCL DoorLock cluster does not have a concept of user names attached to PIN slots. The
nameparameter inasync_set_usercodeis accepted but ignored by the lock hardware. - Sequential slot queries: PIN codes are fetched one slot at a time. This is slower than a bulk read but necessary because the DoorLock cluster only supports per-slot queries.
- Programming event support varies: Some lock models do not fire programming event notifications. Lock Code Manager detects this and enables drift detection as a fallback.
The following locks have been tested with Lock Code Manager via ZHA:
- Kwikset 914 (ZNP coordinator over network)
If you have tested Lock Code Manager with a specific Zigbee lock via ZHA, please open an issue or PR to add it to this list.
Both ZHA and Zigbee2MQTT support Zigbee locks, but they use different communication paths:
| ZHA | Zigbee2MQTT | |
|---|---|---|
| Communication | Direct zigpy cluster commands | MQTT publish/subscribe |
| PIN readback | Direct from lock | Depends on expose_pin setting |
| Push updates | Cluster listener callbacks | MQTT subscription |
| Setup | ZHA integration only | Zigbee2MQTT + MQTT integration |
Both providers support the same lock models. Choose based on which Zigbee coordinator stack you're already using.
Ensure the ZHA integration is loaded and the lock entity appears in Home Assistant as lock.* from the zha platform. The lock must have a DoorLock cluster on one of its endpoints.
- Check that the ZHA integration is connected (Settings > Integrations > ZHA)
- Verify the lock is online (check the device page for availability)
- Check Home Assistant logs with debug logging enabled for
custom_components.lock_code_manager
Lock Code Manager could not find a DoorLock cluster on the device. This may happen if:
- The lock was just paired and hasn't finished initializing
- The device is a lock that doesn't expose the DoorLock cluster (unusual)
Try removing and re-pairing the lock with ZHA.
Getting Started
UI
- Add a UI for lock code management — overview & decision guide
- UI Strategies
- Custom Cards
Features
- Services and Actions
- Blueprints
- Tracking lock state change events
- Using Condition Entities
- Unsupported Condition Entities
- Notifications
Advanced
Development
Troubleshooting
FAQ
Supported Integrations