Custom Component: Lock Code Manager - an integration to manage lock usercodes (Z-Wave only, for now!)

Introducing a new lock code manager: GitHub - raman325/lock_code_manager: Lock code manager for locks integrated with Home Assistant an integration to manage lock usercodes.

When users are looking for a way to manage their Z-Wave lock usercodes, they are usually told to use keymaster. Keymaster is a great integration, and if it’s works for you and you like it, stick with it because “if it ain’t broke don’t fix it.” The reasons why I chose to make this a separate integration instead of building it into keymaster are listed here: GitHub - raman325/lock_code_manager: Lock code manager for locks integrated with Home Assistant

Like keymaster, the integration allows you to set up schedules for when a code should be active, or limit the number of times a PIN can be used. But it can also be useful if you don’t want to have any complex schedules and instead just want an easy way to manage codes.


Disclaimers:

  • Things may not work perfectly yet, but having more users will help in ironing out the kinks.
  • Because of the way this integration works, it might be subject to race conditions that result in weird behaviors. Not sure if this is an actual problem, but be warned.
  • My bandwidth is currently limited, so if you do run into an issue, log an issue in the repo but please be patient. Keymaster still works perfectly fine if you need something to use while your issue is being sorted out.

Key Features:

  • 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

Comparing LCM to Keymaster

If you are trying to evaluate whether to use this or keymaster, here are my opinionated pros and cons:

Advantages of LCM over keymaster:

  • No package files are generated (no files in general)
  • Significantly less entities created (only creates the ones you need, and offloads scheduling to the calendar platform)
  • No automations created
  • Focuses on usercode management and skips features that can be built through automations like auto relock
  • Code is written in a way that makes it much easier to support locks from other integrations in the future (see here for more details: Supporting new lock integrations · raman325/lock_code_manager Wiki · GitHub)
  • UI configuration is simpler

Disavantages of LCM over keymaster:

  • It’s new, so it probably will need some work
  • While keymaster may seem complicated, under the hood it’s actually pretty simple and let’s Home Assistant do a lot of the heavy lifting. LCM looks simpler but the integration handles more things that keymaster offloads to Home Assistant. The end result is that there may be edge cases that LCM doesn’t handle.

If I haven’t scared you away yet, give it a shot! For now, you will need to add the repository as a custom repository to HACS in order to install it, but eventually I hope to get it included in the main list.

5 Likes

That’s an excellent description of how they differ. KeyMaster dips into everything HomeAssistant offers now or in the future. You can use Lovelace, integrations, templates to build some whacked out lock rules. I just copied every rule some other smart home package offfered as a starting point. Then I added some really crazy ones that never made the cut. But to be frank, I’ve never used anything but the simple “on/off” rule. The reason never came up.

Nice work, this seems like a much simpler solution to plug a gap in home assistants base covering for lock controls. With the way this custom component structured, is it going to make it easier to expand to zigbee devices than it has been for for keymaster?