NOTE: This integration is in very early stages, so expect things to not work as expected. Feel free to open issues to report anything you find, but I would not recommend using this for production usage yet.
Lock Code Manager is a Home Assistant integration that allows you to more easily manage your usercodes on your locks. Once you have configured it, the integration will set and clear codes on your locks as needed depending on how you decide to configure them.
Features:
- Synchronize multiple locks with a single set of codes
- Optionally use a calendar entity to activate and deactivate a code
- Optionally define a maximum number of uses for a code before the code is disabled
Locks from the following integrations are currently supported:
- Z-Wave
- Virtual custom integration. See the Wiki page on this integration for more details on why it was built and how it works.
The code was written to make it (I think) easy to add support for locks in other integrations. Check the Wiki if you want to learn more about that and take a stab at it. Contributors welcome!
The best way to install this integration is via HACS.
- Set up your locks as entities to your Home Assistant instance through the corresponding integration (e.g. Z-Wave)
- Add this repository as a custom integration repository in HACS
- Go to Settings > Devices & Services > Add Integration
- Select Lock Code Manager
- Follow the prompts - additional information about the configuration options are available in the Wiki
The Wiki is a WIP but has some content that might be helpful for you!
Lock Code Manager can generate Lovelace dashboards for managing and monitoring PINs. You can use the dashboard strategy (full dashboard), the view strategy (single view for a config entry), or the custom card directly.
See this wiki article for more details.
Use the dashboard strategy to build a full dashboard with one view per config entry, and an optional "User Codes" view that shows lock code data cards across all managed locks.
| Option | Default | Description |
|---|---|---|
include_code_slot_sensors |
false |
Show code slot sensor entities in each slot's card |
include_in_sync_sensors |
true |
Show in-sync sensor entities in each slot's card |
include_code_data_view |
false |
Add a "User Codes" view with cards showing all lock codes |
code_data_view_code_display |
unmasked |
Code visibility mode for the "User Codes" lock data cards |
Example dashboard configuration:
strategy:
type: custom:lock-code-manager
include_code_data_view: true
code_data_view_code_display: masked_with_reveal
include_in_sync_sensors: trueUse the view strategy when you want a single view for one config entry. If
include_code_data_view is true, the "User Codes" section is appended below the slot
cards within the same view (no extra view is created).
| Option | Default | Description |
|---|---|---|
config_entry_id |
- | Config entry ID to render |
config_entry_title |
- | Config entry title to render (alternative to ID) |
include_code_slot_sensors |
false |
Show code slot sensor entities in each slot's card |
include_in_sync_sensors |
true |
Show in-sync sensor entities in each slot's card |
include_code_data_view |
false |
Append a "User Codes" section below the slot cards |
code_data_view_code_display |
unmasked |
Code visibility mode for the "User Codes" lock data cards |
Example view configuration:
strategy:
type: custom:lock-code-manager
config_entry_id: 1234567890abcdef
include_code_data_view: true
code_data_view_code_display: maskedThe lock-code-manager-lock-data card displays all code slots for a specific lock. It can
be added manually or included by the strategies above.
| Option | Required | Default | Description |
|---|---|---|---|
lock_entity_id |
Yes | - | The entity ID of the lock to display codes for |
title |
No | Lock name | Custom title for the card |
code_display |
No | unmasked |
How to display codes: see modes below |
Example card configuration:
type: custom:lock-code-manager-lock-data
lock_entity_id: lock.front_door
title: Front Door Codes
code_display: masked_with_revealCode Display Modes:
masked- Codes are always hidden (shown as bullets)unmasked- Codes are always visiblemasked_with_reveal- Codes are masked but can be revealed with a toggle button
I spent some time contributing to keymaster,
and what I learned working on it, and the regular complaints users had about it generating
too many automations, entities, etc. led me to take a different approach. This isn't a
knock on keymaster, unfortunately a lot of what is built in this integration wasn't
possible for most of keymaster's life. I briefly considered implementing this into
keymaster but:
keymasteris still a great solution that works as is, and is more feature rich than this integration will likely ever be.keymasteris surprisingly simple under the hood because it makes Home Assistant do a lot of the heavy lifting for figuring out when to enable and disable a usercode. This integration, on the other hand, attempts to do all of the heavy lifting internally in code, which means it will generate less entities and automations but it is likely more fragile to changes in HA Core or even changes in the codebase.- It would be impossible to seamlessly migrate users from the current implementation of
keymasterto this integration's implementation. Rewritingkeymasterto do this would have been the equivalent of creating a new integration anyway, and since it's a separate integration, users have a choice of what implementation they want to use. Additionally, you can install the integrations side by side and slowly migrate your locks over in either direction as needed.
A big thank you to the other keymaster maintainers:
- @FutureTense
- @firstof9
As well as the person who created the base concept that keymaster evolved from:
@ptdalen