Lock user codes management unified, inc. users PIN-codes for code-locks + centalized tracking which users locked/unlocked a lock and when + how was locking done (manual from inside, outside keypad, integration service, or Home Assistant Companion, etc.)?

Feature request asking for a native UI that unify user-codes and lock-code management by perhaps extending existing lock integration with key-master type enhancements for centralized user codes for locks with handling of users PINs under user management (for all PIN-codes). Please add a single way of handling numeric PIN-codes for all users and allow those to be assigned to one specific lock or multiple locks.

Update: See directly related architecture/developers discussion about Native lock code functionality:

Update: FYI; @raman325 has a "Lock Code Manager" integration as a costom component available via HACS that allows you to manage user codes for locks but that is so far only for Z-Wave and not either natively integrated into Home Assistant’s settings. See:

and

That in turn was created as alternative for using KeyMaster (Lock-Manager for ZWave) by @FutureTense

Quting key features from raman325’s “Lock Code Manager” integration:

  • Manage when user codes should be enabled or disabled using a calendar entity
  • Track when a user code is used using the event entities, or using the lock_code_manager_lock_state_changed event
  • Sync codes across multiple locks (and you can mix and match which codes you are syncing between which locks, see here for more information: Advanced Usage · raman325/lock_code_manager Wiki · GitHub )
  • Extensible to support other integrations that support usercodes
  • Adds support for a dedicated lock code management dashboard OR a view within an existing dashboard

Where the most important feature is “Extensible to support other integrations that support usercodes”:

This feature request is as such asking for a generic (non-protocol specific) built-in PIN-code handling keymaster for "codelocks" (code locks) under Home Assistant’s user management + track user events/history for “smart locks” user events nativly to Home Assistant’s “lock” integration as a Building block integration (i.e. integration that used and provided by other integrations) to make the default user experience for handling smart locks users and event/history data equivalent to smart-lock manufacturer’s own proprietary apps.

The point is that PIN-code handling for code-locks should be unified and centralized in the UI for better UX, regardless of the IoT protocol used, as part of the lock integration as a building-block integration (so handled in one location for Matter, Zigbee, Z-Wave, HomeKit, etc.) instead of different solutions under each and every integration that makes use of the lock integration as a building-block integration.

And maybe also make the Lock Entiy and Template Lock use it fully as proof-of-concept?

Including the MQTT Lock integration and perhaps aslso Template Lock in ESPHome as well:

Posting this as requesting enhanced features for extended lock management + making the user interface of PIN-codes for locks part of Home Assistant user accounts management/configuration because when researching smart locks solutions with local API control for Home Assistant I was surprised to find out that Home Assistant’s lock integration currently has no built-in default user management interface for smart locks (UI for managing users PIN/PINS and Tags), nor users event tracking for logging user events for racking which users locked/unlocked a lock when, and how was locking done (manual from inside, outside keypad, integration service, or Home Assistant Companion, etc.) to make it easy to enable notifications when a specific user locks/unlocks a lock.

That would among other things allow a notification like “lock was unlocked by keypad operation user1” (Danalock does it) which can also be used for automation.

I believe enhanced generic lock user management is something that is also wanted for many other integrations that in turn make use of the Home Assistant’s lock integration as “lock” integration as a Building block integration (i.e. integration that used and provided by other integrations). Especially now that both Aqara Smart Lock U200 is “Works with Home Assistant” certified, and also Ultraloq (who speciaize in ZWave smart locks) is a Works with Home Assistant partner as well. But perhaps more importantly, there are a lot of other integrations that make use of that lock integration as building block, see:

For example, I have at least seen that August, Yale, and Yale Smart Living (a.k.a. Yale Smart Alarm), and Schlage integrations all seem to be very popular options for smart locks that are featured often by bloggers/vloggers in the Home Assistant Creator Network.

For reference, I am personally currently using a Yale Doorman smartlock with a radio-module for Verisure, and their official app and webinterface have a great interface that includes user management for smartlocks and awesome default features for history tracking + notifications with data on users locked/unlocked a lock when, and how was locking done (unlocked or locked manually from inside, outside keypad, via app why which user). So would be super if the the user experince from Verisure own app/webinterface for smart-lock user management for PIN/PINS and Tags + user events for notifications/history/tracking could be replicated. (The downside with the Verisure integration for Home Assistant is that it does not work locally and instead depends on a cloud service API and uses Cloud Pulling so state reporting lock/unlock events is very slow).

@marcelveldt mentioned in the discussion thread for the Aqara joins Works with Home Assistant blog-post that this is something that Nabu Casa developers want to implement for the Matter integration (for locks using the new Matter standard) and possibly also the Z-Wave JS integration, (and I assume that maybe also locks using the built-in ZHA (Zigbee Gateway) integration will be addressed then too since it is also a large standard?)

PS: Also see this indirectly related frontend request:

Thanks for the detailed post. The consensus has been that we need better lock code management natively in HA but we haven’t figured out how yet. Architecture issue if you’d like to contribute to the discussion: Native lock code functionality · home-assistant/architecture · Discussion #1000 · GitHub

1 Like

@raman325 a new entity for “user code” (for door locks and alarm control panels) sounds promising if could be implemented for at least Z-Wave, Zigbee, and Matter, as the integrations for those should all be equal and best in class!

Anyway, do not know about the backend requirements but from a UI/UX (frontend) point-of-view I like to add that would love it if management of user codes could be implemented similar to how Verisure has it.

I could try to grab a few screenshots from Verisure 's website/app interface, but basically they put all the management of user codes in under user account manager, which otherwise looks and feels very similar to how the “People” section currently is orginized under “Settings” in Home Assistant.

That is, you go under an account and there you can not only set the Username, Password, and permissions, but under there in Verisure 's website/app interface for each user account you can also set (and reset or reset) the “Usercode”, i.e. number PIN-cod and that will then be used for all door locks and alarm control panels.

It is also there that you can set a date/time scheule for when and how long a Usercode can be used.

PS: Verisure also has it so that users NFC-tags is be assigned and managed there right next to the usercode under each user account.

In my opinion, effective user and code management for locks in Home Assistant is less critical than being able to track when and how a lock was activated, and then using that information to create advanced automations.

A simple way to achieve this would be through a text helper that stores only the most recent data entry, including a timestamp. For example: “2024-10-29 17:54 - User1 unlocked with Code: 1234.” This method wouldn’t require standardization across manufacturers, so each lock could simply report whatever data it has available. This way, HA users could extract and process the text for custom automations.

Related to the new “Roadmap 2024 Midyear Update” blog post and the bit there about improving user User Account Control to limit access and permissions the dashboard, I would really love to see native functionality added for “user codes” and PIN-code handling for locks, implemented in a way to enable the UI for user account management to include users PIN-codes for smart locks (code-locks), to both centralized handling of assigning PIN-codes to user accounts in the Home Assistant UI as well as unified functions and bind those PIN-codes to specific smart locks.

Again, for that to be possible Home Assistant core would first need a new entity platform to support codes, and that idea was also brought up by @raman325 in this architecture discussion from a year ago with a suggestion for Home Assistant core to be able to manage codes for locks natively by extending the lock platform natively in order allow users to control of the lock state of a lock, and while not all smart locks have this functionality, many integrations/protocols could be made to support this, including Z-Wave JS`, ZHA (Zigbee), Matter, and some proprietary WiFi or BLE smart locks. See his proposal here: