Latest commit

History

1,041 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Lock Code Manager

Lock Code Manager scales down to a simple UI for managing your lock's PIN codes — and scales up to a programmable, multi-lock, multi-provider PIN platform with scheduled access, condition-driven activation, and automation-ready services. Define your codes once and LCM handles setting, clearing, and monitoring them on every lock, across providers (Z-Wave, ZHA, Matter, and more) without you wiring up the differences.

Whether you just want a clean dashboard for your front door or you're rotating PINs across an Airbnb fleet on a nightly schedule, LCM has you covered.

Features:

  • Give each person a name and a PIN; Lock Code Manager works out which slot on which lock they land in
  • Synchronize PIN codes across multiple locks and providers
  • Automatic sync — codes are set and cleared as needed, with retry and drift detection
  • Condition entities control when a code is active:
    • calendar — active during events
    • binary_sensor / switch / input_boolean — active when on
    • schedule — active during scheduled times
  • Services and actions for adding and removing users, setting/clearing PINs, attaching condition entities, hard-refreshing from the lock, and generating safe random PINs from automations
  • Blueprints for advanced use cases like usage limiting, calendar-driven PINs, and more
  • Check codes entered somewhere Lock Code Manager doesn't control — a do-it-yourself ESPHome keypad, an intercom — against the same users and schedules, and record the use like any other
  • Guest and rental workflows — rotate a standing user per booking, or add and remove them per stay
  • Dashboard strategies and custom cards for managing codes and viewing lock status — from one-line auto-generated dashboards to fully hand-composed layouts

Supported lock integrations:

IntegrationRead PINsPush UpdatesCode EventsNotes
Z-WaveVariesSome locks mask PINs
ZHADrift detection fallback if lock lacks programming events
Zigbee2MQTT (MQTT)²VariesSame broker as Z2M; PIN support depends on lock
Z-Wave JS UI (MQTT)³VariesLocks bridged via zwave-js-ui's MQTT gateway; some locks mask PINs
MatterPINs write-only per spec
Schlage WiFiCloud-based, PINs masked
Akuvox¹Local API, polling-based
Virtual¹A credential store rather than a device: records uses reported by the use_credential action, and lets you try Lock Code Manager without a real lock

¹ Custom integration required (Local Akuvox, hass-virtual)

² Zigbee2MQTT (MQTT) — Pair the lock in Zigbee2MQTT with PIN/user-code support for your firmware. The Code Events column refers to PIN-used automations from Lock Code Manager’s event entity (which slots were used to lock/unlock). Zigbee2MQTT lock/unlock actions with user identification are mapped to code slot events for PIN-used automations. Configure Home Assistant’s MQTT integration on the same broker Zigbee2MQTT uses. Custom Zigbee2MQTT base topics — including multi-level topics (e.g. home/z2m) and multiple bridges on one broker — are supported automatically: Lock Code Manager reads each lock’s exact MQTT topic from the discovery data Zigbee2MQTT publishes to Home Assistant, so no extra configuration is needed. Locks must be added to Home Assistant via MQTT discovery (Zigbee2MQTT’s default). During LCM setup, choose your lock.* entity from MQTT.

³ Z-Wave JS UI (MQTT) — For Z-Wave locks exposed to Home Assistant through zwave-js-ui's MQTT discovery gateway rather than the official websocket integration (which the Z-Wave row covers, and which zwave-js-ui itself recommends — switching needs no re-pairing). Reads and writes go through zwave-js-ui's MQTT api; gateway type Named or ValueID gives full functionality including push updates and PIN-used events, while Manual runs polling-only. Configure Home Assistant’s MQTT integration on the same broker zwave-js-ui uses.

Adding support for new lock integrations is straightforward — see the Adding a Provider guide. Contributors welcome!

Integrations That Cannot Currently Be Supported

Some lock integrations cannot currently be supported due to limitations in their underlying libraries. See the wiki for details.

Condition Entity Integrations Not Supported

Some integrations create entities whose states don't map to LCM condition entity semantics ("access allowed" / "access denied"). The integration may still be usable with LCM by driving slot Enabled switches from its own automation logic instead of attaching its entities as condition entities. See the wiki for details and the scheduler-component workaround.

Installation

The best way to install this integration is via HACS.

  1. Set up your locks in Home Assistant through a supported integration (Z-Wave, ZHA, Matter, Schlage, Zigbee2MQTT/MQTT, etc.)
  2. Add this repository as a custom integration repository in HACS
  3. Go to Settings > Devices & Services > Add Integration
  4. Select Lock Code Manager
  5. Follow the prompts - additional information about the configuration options are available in the Wiki

Blueprints

Pre-built automations and templates for common lock management patterns. See BLUEPRINTS.md for full details, input tables, and import buttons.

Template blueprints

  • Calendar Condition — Binary sensor for calendar-based access
  • Date Range Condition — Binary sensor for start/end date access

Automation blueprints

  • Slot Usage Limiter — Disable a user after a set number of uses
  • Calendar PIN Setter — Extract and set PINs from calendar events
  • Auto Re-lock — Re-lock after a delay with day/night support
  • Lock on Door Close — Lock when a door sensor detects closure
  • Slot Usage Notifier — Notify when someone's credential is used
  • Credential Used — Run any actions when a credential is used, from a lock's own keypad or an external one
  • Condition Linker — Assign a condition entity to a user via UI

Learn More

Visit the Wiki for detailed documentation including configuration, troubleshooting, dashboard setup, and development guides.

Upgrading from 4.x? 5.0 is configured by user rather than by slot number, and migrating renames every entity ID. Read Upgrading to 5.0 first — the migration is one-way.

UI & Dashboards

Lock Code Manager ships custom Lovelace strategies (which auto-generate UI from your config) and custom cards (which you compose yourself). Pick the one that matches how much control you want — from a one-click dashboard that just works (selectable directly from Settings → Dashboards → Add Dashboard on Home Assistant 2026.5+) to a hand-authored layout that places exactly what you want where you want it.

AI Usage

While I began this project before AI coding agents and wrote the bones myself, since November 2025 it's been hard NOT to code with a coding agent. You will notice that almost all of my PRs since then have been co-authored with Claude (I've also experimented with Codex and Copilot).

If you look at any of the PRs, particularly the meaningful ones, you'll notice many commits. Some come from AI code reviews, but many come from my own code reviews or from me steering the design. I can't say I've audited everything line for line, but I can comfortably say that it's not exfiltrating your data or doing anything evil.

If you are uncomfortable using this integration because of concerns around AI, I completely understand and that is your prerogative. If you ever want to chat about it — whether it's to convince me that what I'm doing is wrong, to learn more about it, or anything in between — find me on the Home Assistant Discord.

About

Lock code manager for locks integrated with Home Assistant

Topics

Resources

Stars

102 stars

Watchers

4 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Latest commit

History

1,041 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Lock Code Manager

Lock Code Manager scales down to a simple UI for managing your lock's PIN codes — and scales up to a programmable, multi-lock, multi-provider PIN platform with scheduled access, condition-driven activation, and automation-ready services. Define your codes once and LCM handles setting, clearing, and monitoring them on every lock, across providers (Z-Wave, ZHA, Matter, and more) without you wiring up the differences.

Whether you just want a clean dashboard for your front door or you're rotating PINs across an Airbnb fleet on a nightly schedule, LCM has you covered.

Features:

  • Give each person a name and a PIN; Lock Code Manager works out which slot on which lock they land in
  • Synchronize PIN codes across multiple locks and providers
  • Automatic sync — codes are set and cleared as needed, with retry and drift detection
  • Condition entities control when a code is active:
    • calendar — active during events
    • binary_sensor / switch / input_boolean — active when on
    • schedule — active during scheduled times
  • Services and actions for adding and removing users, setting/clearing PINs, attaching condition entities, hard-refreshing from the lock, and generating safe random PINs from automations
  • Blueprints for advanced use cases like usage limiting, calendar-driven PINs, and more
  • Check codes entered somewhere Lock Code Manager doesn't control — a do-it-yourself ESPHome keypad, an intercom — against the same users and schedules, and record the use like any other
  • Guest and rental workflows — rotate a standing user per booking, or add and remove them per stay
  • Dashboard strategies and custom cards for managing codes and viewing lock status — from one-line auto-generated dashboards to fully hand-composed layouts

Supported lock integrations:

IntegrationRead PINsPush UpdatesCode EventsNotes
Z-WaveVariesSome locks mask PINs
ZHADrift detection fallback if lock lacks programming events
Zigbee2MQTT (MQTT)²VariesSame broker as Z2M; PIN support depends on lock
Z-Wave JS UI (MQTT)³VariesLocks bridged via zwave-js-ui's MQTT gateway; some locks mask PINs
MatterPINs write-only per spec
Schlage WiFiCloud-based, PINs masked
Akuvox¹Local API, polling-based
Virtual¹A credential store rather than a device: records uses reported by the use_credential action, and lets you try Lock Code Manager without a real lock

¹ Custom integration required (Local Akuvox, hass-virtual)

² Zigbee2MQTT (MQTT) — Pair the lock in Zigbee2MQTT with PIN/user-code support for your firmware. The Code Events column refers to PIN-used automations from Lock Code Manager’s event entity (which slots were used to lock/unlock). Zigbee2MQTT lock/unlock actions with user identification are mapped to code slot events for PIN-used automations. Configure Home Assistant’s MQTT integration on the same broker Zigbee2MQTT uses. Custom Zigbee2MQTT base topics — including multi-level topics (e.g. home/z2m) and multiple bridges on one broker — are supported automatically: Lock Code Manager reads each lock’s exact MQTT topic from the discovery data Zigbee2MQTT publishes to Home Assistant, so no extra configuration is needed. Locks must be added to Home Assistant via MQTT discovery (Zigbee2MQTT’s default). During LCM setup, choose your lock.* entity from MQTT.

³ Z-Wave JS UI (MQTT) — For Z-Wave locks exposed to Home Assistant through zwave-js-ui's MQTT discovery gateway rather than the official websocket integration (which the Z-Wave row covers, and which zwave-js-ui itself recommends — switching needs no re-pairing). Reads and writes go through zwave-js-ui's MQTT api; gateway type Named or ValueID gives full functionality including push updates and PIN-used events, while Manual runs polling-only. Configure Home Assistant’s MQTT integration on the same broker zwave-js-ui uses.

Adding support for new lock integrations is straightforward — see the Adding a Provider guide. Contributors welcome!

Integrations That Cannot Currently Be Supported

Some lock integrations cannot currently be supported due to limitations in their underlying libraries. See the wiki for details.

Condition Entity Integrations Not Supported

Some integrations create entities whose states don't map to LCM condition entity semantics ("access allowed" / "access denied"). The integration may still be usable with LCM by driving slot Enabled switches from its own automation logic instead of attaching its entities as condition entities. See the wiki for details and the scheduler-component workaround.

Installation

The best way to install this integration is via HACS.

  1. Set up your locks in Home Assistant through a supported integration (Z-Wave, ZHA, Matter, Schlage, Zigbee2MQTT/MQTT, etc.)
  2. Add this repository as a custom integration repository in HACS
  3. Go to Settings > Devices & Services > Add Integration
  4. Select Lock Code Manager
  5. Follow the prompts - additional information about the configuration options are available in the Wiki

Blueprints

Pre-built automations and templates for common lock management patterns. See BLUEPRINTS.md for full details, input tables, and import buttons.

Template blueprints

  • Calendar Condition — Binary sensor for calendar-based access
  • Date Range Condition — Binary sensor for start/end date access

Automation blueprints

  • Slot Usage Limiter — Disable a user after a set number of uses
  • Calendar PIN Setter — Extract and set PINs from calendar events
  • Auto Re-lock — Re-lock after a delay with day/night support
  • Lock on Door Close — Lock when a door sensor detects closure
  • Slot Usage Notifier — Notify when someone's credential is used
  • Credential Used — Run any actions when a credential is used, from a lock's own keypad or an external one
  • Condition Linker — Assign a condition entity to a user via UI

Learn More

Visit the Wiki for detailed documentation including configuration, troubleshooting, dashboard setup, and development guides.

Upgrading from 4.x? 5.0 is configured by user rather than by slot number, and migrating renames every entity ID. Read Upgrading to 5.0 first — the migration is one-way.

UI & Dashboards

Lock Code Manager ships custom Lovelace strategies (which auto-generate UI from your config) and custom cards (which you compose yourself). Pick the one that matches how much control you want — from a one-click dashboard that just works (selectable directly from Settings → Dashboards → Add Dashboard on Home Assistant 2026.5+) to a hand-authored layout that places exactly what you want where you want it.

AI Usage

While I began this project before AI coding agents and wrote the bones myself, since November 2025 it's been hard NOT to code with a coding agent. You will notice that almost all of my PRs since then have been co-authored with Claude (I've also experimented with Codex and Copilot).

If you look at any of the PRs, particularly the meaningful ones, you'll notice many commits. Some come from AI code reviews, but many come from my own code reviews or from me steering the design. I can't say I've audited everything line for line, but I can comfortably say that it's not exfiltrating your data or doing anything evil.

If you are uncomfortable using this integration because of concerns around AI, I completely understand and that is your prerogative. If you ever want to chat about it — whether it's to convince me that what I'm doing is wrong, to learn more about it, or anything in between — find me on the Home Assistant Discord.

About

Lock code manager for locks integrated with Home Assistant

Topics

Resources

Stars

102 stars

Watchers

4 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

1,041 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Lock Code Manager

Lock Code Manager scales down to a simple UI for managing your lock's PIN codes — and scales up to a programmable, multi-lock, multi-provider PIN platform with scheduled access, condition-driven activation, and automation-ready services. Define your codes once and LCM handles setting, clearing, and monitoring them on every lock, across providers (Z-Wave, ZHA, Matter, and more) without you wiring up the differences.

Whether you just want a clean dashboard for your front door or you're rotating PINs across an Airbnb fleet on a nightly schedule, LCM has you covered.

Features:

  • Give each person a name and a PIN; Lock Code Manager works out which slot on which lock they land in
  • Synchronize PIN codes across multiple locks and providers
  • Automatic sync — codes are set and cleared as needed, with retry and drift detection
  • Condition entities control when a code is active:
    • calendar — active during events
    • binary_sensor / switch / input_boolean — active when on
    • schedule — active during scheduled times
  • Services and actions for adding and removing users, setting/clearing PINs, attaching condition entities, hard-refreshing from the lock, and generating safe random PINs from automations
  • Blueprints for advanced use cases like usage limiting, calendar-driven PINs, and more
  • Check codes entered somewhere Lock Code Manager doesn't control — a do-it-yourself ESPHome keypad, an intercom — against the same users and schedules, and record the use like any other
  • Guest and rental workflows — rotate a standing user per booking, or add and remove them per stay
  • Dashboard strategies and custom cards for managing codes and viewing lock status — from one-line auto-generated dashboards to fully hand-composed layouts

Supported lock integrations:

IntegrationRead PINsPush UpdatesCode EventsNotes
Z-WaveVariesSome locks mask PINs
ZHADrift detection fallback if lock lacks programming events
Zigbee2MQTT (MQTT)²VariesSame broker as Z2M; PIN support depends on lock
Z-Wave JS UI (MQTT)³VariesLocks bridged via zwave-js-ui's MQTT gateway; some locks mask PINs
MatterPINs write-only per spec
Schlage WiFiCloud-based, PINs masked
Akuvox¹Local API, polling-based
Virtual¹A credential store rather than a device: records uses reported by the use_credential action, and lets you try Lock Code Manager without a real lock

¹ Custom integration required (Local Akuvox, hass-virtual)

² Zigbee2MQTT (MQTT) — Pair the lock in Zigbee2MQTT with PIN/user-code support for your firmware. The Code Events column refers to PIN-used automations from Lock Code Manager’s event entity (which slots were used to lock/unlock). Zigbee2MQTT lock/unlock actions with user identification are mapped to code slot events for PIN-used automations. Configure Home Assistant’s MQTT integration on the same broker Zigbee2MQTT uses. Custom Zigbee2MQTT base topics — including multi-level topics (e.g. home/z2m) and multiple bridges on one broker — are supported automatically: Lock Code Manager reads each lock’s exact MQTT topic from the discovery data Zigbee2MQTT publishes to Home Assistant, so no extra configuration is needed. Locks must be added to Home Assistant via MQTT discovery (Zigbee2MQTT’s default). During LCM setup, choose your lock.* entity from MQTT.

³ Z-Wave JS UI (MQTT) — For Z-Wave locks exposed to Home Assistant through zwave-js-ui's MQTT discovery gateway rather than the official websocket integration (which the Z-Wave row covers, and which zwave-js-ui itself recommends — switching needs no re-pairing). Reads and writes go through zwave-js-ui's MQTT api; gateway type Named or ValueID gives full functionality including push updates and PIN-used events, while Manual runs polling-only. Configure Home Assistant’s MQTT integration on the same broker zwave-js-ui uses.

Adding support for new lock integrations is straightforward — see the Adding a Provider guide. Contributors welcome!

Integrations That Cannot Currently Be Supported

Some lock integrations cannot currently be supported due to limitations in their underlying libraries. See the wiki for details.

Condition Entity Integrations Not Supported

Some integrations create entities whose states don't map to LCM condition entity semantics ("access allowed" / "access denied"). The integration may still be usable with LCM by driving slot Enabled switches from its own automation logic instead of attaching its entities as condition entities. See the wiki for details and the scheduler-component workaround.

Installation

The best way to install this integration is via HACS.

  1. Set up your locks in Home Assistant through a supported integration (Z-Wave, ZHA, Matter, Schlage, Zigbee2MQTT/MQTT, etc.)
  2. Add this repository as a custom integration repository in HACS
  3. Go to Settings > Devices & Services > Add Integration
  4. Select Lock Code Manager
  5. Follow the prompts - additional information about the configuration options are available in the Wiki

Blueprints

Pre-built automations and templates for common lock management patterns. See BLUEPRINTS.md for full details, input tables, and import buttons.

Template blueprints

  • Calendar Condition — Binary sensor for calendar-based access
  • Date Range Condition — Binary sensor for start/end date access

Automation blueprints

  • Slot Usage Limiter — Disable a user after a set number of uses
  • Calendar PIN Setter — Extract and set PINs from calendar events
  • Auto Re-lock — Re-lock after a delay with day/night support
  • Lock on Door Close — Lock when a door sensor detects closure
  • Slot Usage Notifier — Notify when someone's credential is used
  • Credential Used — Run any actions when a credential is used, from a lock's own keypad or an external one
  • Condition Linker — Assign a condition entity to a user via UI

Learn More

Visit the Wiki for detailed documentation including configuration, troubleshooting, dashboard setup, and development guides.

Upgrading from 4.x? 5.0 is configured by user rather than by slot number, and migrating renames every entity ID. Read Upgrading to 5.0 first — the migration is one-way.

UI & Dashboards

Lock Code Manager ships custom Lovelace strategies (which auto-generate UI from your config) and custom cards (which you compose yourself). Pick the one that matches how much control you want — from a one-click dashboard that just works (selectable directly from Settings → Dashboards → Add Dashboard on Home Assistant 2026.5+) to a hand-authored layout that places exactly what you want where you want it.

AI Usage

While I began this project before AI coding agents and wrote the bones myself, since November 2025 it's been hard NOT to code with a coding agent. You will notice that almost all of my PRs since then have been co-authored with Claude (I've also experimented with Codex and Copilot).

If you look at any of the PRs, particularly the meaningful ones, you'll notice many commits. Some come from AI code reviews, but many come from my own code reviews or from me steering the design. I can't say I've audited everything line for line, but I can comfortably say that it's not exfiltrating your data or doing anything evil.

If you are uncomfortable using this integration because of concerns around AI, I completely understand and that is your prerogative. If you ever want to chat about it — whether it's to convince me that what I'm doing is wrong, to learn more about it, or anything in between — find me on the Home Assistant Discord.

About

Lock code manager for locks integrated with Home Assistant

Topics

Resources

Stars

102 stars

Watchers

4 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

1,041 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Lock Code Manager

Lock Code Manager scales down to a simple UI for managing your lock's PIN codes — and scales up to a programmable, multi-lock, multi-provider PIN platform with scheduled access, condition-driven activation, and automation-ready services. Define your codes once and LCM handles setting, clearing, and monitoring them on every lock, across providers (Z-Wave, ZHA, Matter, and more) without you wiring up the differences.

Whether you just want a clean dashboard for your front door or you're rotating PINs across an Airbnb fleet on a nightly schedule, LCM has you covered.

Features:

  • Give each person a name and a PIN; Lock Code Manager works out which slot on which lock they land in
  • Synchronize PIN codes across multiple locks and providers
  • Automatic sync — codes are set and cleared as needed, with retry and drift detection
  • Condition entities control when a code is active:
    • calendar — active during events
    • binary_sensor / switch / input_boolean — active when on
    • schedule — active during scheduled times
  • Services and actions for adding and removing users, setting/clearing PINs, attaching condition entities, hard-refreshing from the lock, and generating safe random PINs from automations
  • Blueprints for advanced use cases like usage limiting, calendar-driven PINs, and more
  • Check codes entered somewhere Lock Code Manager doesn't control — a do-it-yourself ESPHome keypad, an intercom — against the same users and schedules, and record the use like any other
  • Guest and rental workflows — rotate a standing user per booking, or add and remove them per stay
  • Dashboard strategies and custom cards for managing codes and viewing lock status — from one-line auto-generated dashboards to fully hand-composed layouts

Supported lock integrations:

IntegrationRead PINsPush UpdatesCode EventsNotes
Z-WaveVariesSome locks mask PINs
ZHADrift detection fallback if lock lacks programming events
Zigbee2MQTT (MQTT)²VariesSame broker as Z2M; PIN support depends on lock
Z-Wave JS UI (MQTT)³VariesLocks bridged via zwave-js-ui's MQTT gateway; some locks mask PINs
MatterPINs write-only per spec
Schlage WiFiCloud-based, PINs masked
Akuvox¹Local API, polling-based
Virtual¹A credential store rather than a device: records uses reported by the use_credential action, and lets you try Lock Code Manager without a real lock

¹ Custom integration required (Local Akuvox, hass-virtual)

² Zigbee2MQTT (MQTT) — Pair the lock in Zigbee2MQTT with PIN/user-code support for your firmware. The Code Events column refers to PIN-used automations from Lock Code Manager’s event entity (which slots were used to lock/unlock). Zigbee2MQTT lock/unlock actions with user identification are mapped to code slot events for PIN-used automations. Configure Home Assistant’s MQTT integration on the same broker Zigbee2MQTT uses. Custom Zigbee2MQTT base topics — including multi-level topics (e.g. home/z2m) and multiple bridges on one broker — are supported automatically: Lock Code Manager reads each lock’s exact MQTT topic from the discovery data Zigbee2MQTT publishes to Home Assistant, so no extra configuration is needed. Locks must be added to Home Assistant via MQTT discovery (Zigbee2MQTT’s default). During LCM setup, choose your lock.* entity from MQTT.

³ Z-Wave JS UI (MQTT) — For Z-Wave locks exposed to Home Assistant through zwave-js-ui's MQTT discovery gateway rather than the official websocket integration (which the Z-Wave row covers, and which zwave-js-ui itself recommends — switching needs no re-pairing). Reads and writes go through zwave-js-ui's MQTT api; gateway type Named or ValueID gives full functionality including push updates and PIN-used events, while Manual runs polling-only. Configure Home Assistant’s MQTT integration on the same broker zwave-js-ui uses.

Adding support for new lock integrations is straightforward — see the Adding a Provider guide. Contributors welcome!

Integrations That Cannot Currently Be Supported

Some lock integrations cannot currently be supported due to limitations in their underlying libraries. See the wiki for details.

Condition Entity Integrations Not Supported

Some integrations create entities whose states don't map to LCM condition entity semantics ("access allowed" / "access denied"). The integration may still be usable with LCM by driving slot Enabled switches from its own automation logic instead of attaching its entities as condition entities. See the wiki for details and the scheduler-component workaround.

Installation

The best way to install this integration is via HACS.

  1. Set up your locks in Home Assistant through a supported integration (Z-Wave, ZHA, Matter, Schlage, Zigbee2MQTT/MQTT, etc.)
  2. Add this repository as a custom integration repository in HACS
  3. Go to Settings > Devices & Services > Add Integration
  4. Select Lock Code Manager
  5. Follow the prompts - additional information about the configuration options are available in the Wiki

Blueprints

Pre-built automations and templates for common lock management patterns. See BLUEPRINTS.md for full details, input tables, and import buttons.

Template blueprints

  • Calendar Condition — Binary sensor for calendar-based access
  • Date Range Condition — Binary sensor for start/end date access

Automation blueprints

  • Slot Usage Limiter — Disable a user after a set number of uses
  • Calendar PIN Setter — Extract and set PINs from calendar events
  • Auto Re-lock — Re-lock after a delay with day/night support
  • Lock on Door Close — Lock when a door sensor detects closure
  • Slot Usage Notifier — Notify when someone's credential is used
  • Credential Used — Run any actions when a credential is used, from a lock's own keypad or an external one
  • Condition Linker — Assign a condition entity to a user via UI

Learn More

Visit the Wiki for detailed documentation including configuration, troubleshooting, dashboard setup, and development guides.

Upgrading from 4.x? 5.0 is configured by user rather than by slot number, and migrating renames every entity ID. Read Upgrading to 5.0 first — the migration is one-way.

UI & Dashboards

Lock Code Manager ships custom Lovelace strategies (which auto-generate UI from your config) and custom cards (which you compose yourself). Pick the one that matches how much control you want — from a one-click dashboard that just works (selectable directly from Settings → Dashboards → Add Dashboard on Home Assistant 2026.5+) to a hand-authored layout that places exactly what you want where you want it.

AI Usage

While I began this project before AI coding agents and wrote the bones myself, since November 2025 it's been hard NOT to code with a coding agent. You will notice that almost all of my PRs since then have been co-authored with Claude (I've also experimented with Codex and Copilot).

If you look at any of the PRs, particularly the meaningful ones, you'll notice many commits. Some come from AI code reviews, but many come from my own code reviews or from me steering the design. I can't say I've audited everything line for line, but I can comfortably say that it's not exfiltrating your data or doing anything evil.

If you are uncomfortable using this integration because of concerns around AI, I completely understand and that is your prerogative. If you ever want to chat about it — whether it's to convince me that what I'm doing is wrong, to learn more about it, or anything in between — find me on the Home Assistant Discord.

About

Lock code manager for locks integrated with Home Assistant

Topics

Resources

Stars

102 stars

Watchers

4 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Latest commit

History

1,041 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Lock Code Manager

Lock Code Manager scales down to a simple UI for managing your lock's PIN codes — and scales up to a programmable, multi-lock, multi-provider PIN platform with scheduled access, condition-driven activation, and automation-ready services. Define your codes once and LCM handles setting, clearing, and monitoring them on every lock, across providers (Z-Wave, ZHA, Matter, and more) without you wiring up the differences.

Whether you just want a clean dashboard for your front door or you're rotating PINs across an Airbnb fleet on a nightly schedule, LCM has you covered.

Features:

  • Give each person a name and a PIN; Lock Code Manager works out which slot on which lock they land in
  • Synchronize PIN codes across multiple locks and providers
  • Automatic sync — codes are set and cleared as needed, with retry and drift detection
  • Condition entities control when a code is active:
    • calendar — active during events
    • binary_sensor / switch / input_boolean — active when on
    • schedule — active during scheduled times
  • Services and actions for adding and removing users, setting/clearing PINs, attaching condition entities, hard-refreshing from the lock, and generating safe random PINs from automations
  • Blueprints for advanced use cases like usage limiting, calendar-driven PINs, and more
  • Check codes entered somewhere Lock Code Manager doesn't control — a do-it-yourself ESPHome keypad, an intercom — against the same users and schedules, and record the use like any other
  • Guest and rental workflows — rotate a standing user per booking, or add and remove them per stay
  • Dashboard strategies and custom cards for managing codes and viewing lock status — from one-line auto-generated dashboards to fully hand-composed layouts

Supported lock integrations:

IntegrationRead PINsPush UpdatesCode EventsNotes
Z-WaveVariesSome locks mask PINs
ZHADrift detection fallback if lock lacks programming events
Zigbee2MQTT (MQTT)²VariesSame broker as Z2M; PIN support depends on lock
Z-Wave JS UI (MQTT)³VariesLocks bridged via zwave-js-ui's MQTT gateway; some locks mask PINs
MatterPINs write-only per spec
Schlage WiFiCloud-based, PINs masked
Akuvox¹Local API, polling-based
Virtual¹A credential store rather than a device: records uses reported by the use_credential action, and lets you try Lock Code Manager without a real lock

¹ Custom integration required (Local Akuvox, hass-virtual)

² Zigbee2MQTT (MQTT) — Pair the lock in Zigbee2MQTT with PIN/user-code support for your firmware. The Code Events column refers to PIN-used automations from Lock Code Manager’s event entity (which slots were used to lock/unlock). Zigbee2MQTT lock/unlock actions with user identification are mapped to code slot events for PIN-used automations. Configure Home Assistant’s MQTT integration on the same broker Zigbee2MQTT uses. Custom Zigbee2MQTT base topics — including multi-level topics (e.g. home/z2m) and multiple bridges on one broker — are supported automatically: Lock Code Manager reads each lock’s exact MQTT topic from the discovery data Zigbee2MQTT publishes to Home Assistant, so no extra configuration is needed. Locks must be added to Home Assistant via MQTT discovery (Zigbee2MQTT’s default). During LCM setup, choose your lock.* entity from MQTT.

³ Z-Wave JS UI (MQTT) — For Z-Wave locks exposed to Home Assistant through zwave-js-ui's MQTT discovery gateway rather than the official websocket integration (which the Z-Wave row covers, and which zwave-js-ui itself recommends — switching needs no re-pairing). Reads and writes go through zwave-js-ui's MQTT api; gateway type Named or ValueID gives full functionality including push updates and PIN-used events, while Manual runs polling-only. Configure Home Assistant’s MQTT integration on the same broker zwave-js-ui uses.

Adding support for new lock integrations is straightforward — see the Adding a Provider guide. Contributors welcome!

Integrations That Cannot Currently Be Supported

Some lock integrations cannot currently be supported due to limitations in their underlying libraries. See the wiki for details.

Condition Entity Integrations Not Supported

Some integrations create entities whose states don't map to LCM condition entity semantics ("access allowed" / "access denied"). The integration may still be usable with LCM by driving slot Enabled switches from its own automation logic instead of attaching its entities as condition entities. See the wiki for details and the scheduler-component workaround.

Installation

The best way to install this integration is via HACS.

  1. Set up your locks in Home Assistant through a supported integration (Z-Wave, ZHA, Matter, Schlage, Zigbee2MQTT/MQTT, etc.)
  2. Add this repository as a custom integration repository in HACS
  3. Go to Settings > Devices & Services > Add Integration
  4. Select Lock Code Manager
  5. Follow the prompts - additional information about the configuration options are available in the Wiki

Blueprints

Pre-built automations and templates for common lock management patterns. See BLUEPRINTS.md for full details, input tables, and import buttons.

Template blueprints

  • Calendar Condition — Binary sensor for calendar-based access
  • Date Range Condition — Binary sensor for start/end date access

Automation blueprints

  • Slot Usage Limiter — Disable a user after a set number of uses
  • Calendar PIN Setter — Extract and set PINs from calendar events
  • Auto Re-lock — Re-lock after a delay with day/night support
  • Lock on Door Close — Lock when a door sensor detects closure
  • Slot Usage Notifier — Notify when someone's credential is used
  • Credential Used — Run any actions when a credential is used, from a lock's own keypad or an external one
  • Condition Linker — Assign a condition entity to a user via UI

Learn More

Visit the Wiki for detailed documentation including configuration, troubleshooting, dashboard setup, and development guides.

Upgrading from 4.x? 5.0 is configured by user rather than by slot number, and migrating renames every entity ID. Read Upgrading to 5.0 first — the migration is one-way.

UI & Dashboards

Lock Code Manager ships custom Lovelace strategies (which auto-generate UI from your config) and custom cards (which you compose yourself). Pick the one that matches how much control you want — from a one-click dashboard that just works (selectable directly from Settings → Dashboards → Add Dashboard on Home Assistant 2026.5+) to a hand-authored layout that places exactly what you want where you want it.

AI Usage

While I began this project before AI coding agents and wrote the bones myself, since November 2025 it's been hard NOT to code with a coding agent. You will notice that almost all of my PRs since then have been co-authored with Claude (I've also experimented with Codex and Copilot).

If you look at any of the PRs, particularly the meaningful ones, you'll notice many commits. Some come from AI code reviews, but many come from my own code reviews or from me steering the design. I can't say I've audited everything line for line, but I can comfortably say that it's not exfiltrating your data or doing anything evil.

If you are uncomfortable using this integration because of concerns around AI, I completely understand and that is your prerogative. If you ever want to chat about it — whether it's to convince me that what I'm doing is wrong, to learn more about it, or anything in between — find me on the Home Assistant Discord.

About

Lock code manager for locks integrated with Home Assistant

Topics

Resources

Stars

102 stars

Watchers

4 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

1,041 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Lock Code Manager

Lock Code Manager scales down to a simple UI for managing your lock's PIN codes — and scales up to a programmable, multi-lock, multi-provider PIN platform with scheduled access, condition-driven activation, and automation-ready services. Define your codes once and LCM handles setting, clearing, and monitoring them on every lock, across providers (Z-Wave, ZHA, Matter, and more) without you wiring up the differences.

Whether you just want a clean dashboard for your front door or you're rotating PINs across an Airbnb fleet on a nightly schedule, LCM has you covered.

Features:

  • Give each person a name and a PIN; Lock Code Manager works out which slot on which lock they land in
  • Synchronize PIN codes across multiple locks and providers
  • Automatic sync — codes are set and cleared as needed, with retry and drift detection
  • Condition entities control when a code is active:
    • calendar — active during events
    • binary_sensor / switch / input_boolean — active when on
    • schedule — active during scheduled times
  • Services and actions for adding and removing users, setting/clearing PINs, attaching condition entities, hard-refreshing from the lock, and generating safe random PINs from automations
  • Blueprints for advanced use cases like usage limiting, calendar-driven PINs, and more
  • Check codes entered somewhere Lock Code Manager doesn't control — a do-it-yourself ESPHome keypad, an intercom — against the same users and schedules, and record the use like any other
  • Guest and rental workflows — rotate a standing user per booking, or add and remove them per stay
  • Dashboard strategies and custom cards for managing codes and viewing lock status — from one-line auto-generated dashboards to fully hand-composed layouts

Supported lock integrations:

IntegrationRead PINsPush UpdatesCode EventsNotes
Z-WaveVariesSome locks mask PINs
ZHADrift detection fallback if lock lacks programming events
Zigbee2MQTT (MQTT)²VariesSame broker as Z2M; PIN support depends on lock
Z-Wave JS UI (MQTT)³VariesLocks bridged via zwave-js-ui's MQTT gateway; some locks mask PINs
MatterPINs write-only per spec
Schlage WiFiCloud-based, PINs masked
Akuvox¹Local API, polling-based
Virtual¹A credential store rather than a device: records uses reported by the use_credential action, and lets you try Lock Code Manager without a real lock

¹ Custom integration required (Local Akuvox, hass-virtual)

² Zigbee2MQTT (MQTT) — Pair the lock in Zigbee2MQTT with PIN/user-code support for your firmware. The Code Events column refers to PIN-used automations from Lock Code Manager’s event entity (which slots were used to lock/unlock). Zigbee2MQTT lock/unlock actions with user identification are mapped to code slot events for PIN-used automations. Configure Home Assistant’s MQTT integration on the same broker Zigbee2MQTT uses. Custom Zigbee2MQTT base topics — including multi-level topics (e.g. home/z2m) and multiple bridges on one broker — are supported automatically: Lock Code Manager reads each lock’s exact MQTT topic from the discovery data Zigbee2MQTT publishes to Home Assistant, so no extra configuration is needed. Locks must be added to Home Assistant via MQTT discovery (Zigbee2MQTT’s default). During LCM setup, choose your lock.* entity from MQTT.

³ Z-Wave JS UI (MQTT) — For Z-Wave locks exposed to Home Assistant through zwave-js-ui's MQTT discovery gateway rather than the official websocket integration (which the Z-Wave row covers, and which zwave-js-ui itself recommends — switching needs no re-pairing). Reads and writes go through zwave-js-ui's MQTT api; gateway type Named or ValueID gives full functionality including push updates and PIN-used events, while Manual runs polling-only. Configure Home Assistant’s MQTT integration on the same broker zwave-js-ui uses.

Adding support for new lock integrations is straightforward — see the Adding a Provider guide. Contributors welcome!

Integrations That Cannot Currently Be Supported

Some lock integrations cannot currently be supported due to limitations in their underlying libraries. See the wiki for details.

Condition Entity Integrations Not Supported

Some integrations create entities whose states don't map to LCM condition entity semantics ("access allowed" / "access denied"). The integration may still be usable with LCM by driving slot Enabled switches from its own automation logic instead of attaching its entities as condition entities. See the wiki for details and the scheduler-component workaround.

Installation

The best way to install this integration is via HACS.

  1. Set up your locks in Home Assistant through a supported integration (Z-Wave, ZHA, Matter, Schlage, Zigbee2MQTT/MQTT, etc.)
  2. Add this repository as a custom integration repository in HACS
  3. Go to Settings > Devices & Services > Add Integration
  4. Select Lock Code Manager
  5. Follow the prompts - additional information about the configuration options are available in the Wiki

Blueprints

Pre-built automations and templates for common lock management patterns. See BLUEPRINTS.md for full details, input tables, and import buttons.

Template blueprints

  • Calendar Condition — Binary sensor for calendar-based access
  • Date Range Condition — Binary sensor for start/end date access

Automation blueprints

  • Slot Usage Limiter — Disable a user after a set number of uses
  • Calendar PIN Setter — Extract and set PINs from calendar events
  • Auto Re-lock — Re-lock after a delay with day/night support
  • Lock on Door Close — Lock when a door sensor detects closure
  • Slot Usage Notifier — Notify when someone's credential is used
  • Credential Used — Run any actions when a credential is used, from a lock's own keypad or an external one
  • Condition Linker — Assign a condition entity to a user via UI

Learn More

Visit the Wiki for detailed documentation including configuration, troubleshooting, dashboard setup, and development guides.

Upgrading from 4.x? 5.0 is configured by user rather than by slot number, and migrating renames every entity ID. Read Upgrading to 5.0 first — the migration is one-way.

UI & Dashboards

Lock Code Manager ships custom Lovelace strategies (which auto-generate UI from your config) and custom cards (which you compose yourself). Pick the one that matches how much control you want — from a one-click dashboard that just works (selectable directly from Settings → Dashboards → Add Dashboard on Home Assistant 2026.5+) to a hand-authored layout that places exactly what you want where you want it.

AI Usage

While I began this project before AI coding agents and wrote the bones myself, since November 2025 it's been hard NOT to code with a coding agent. You will notice that almost all of my PRs since then have been co-authored with Claude (I've also experimented with Codex and Copilot).

If you look at any of the PRs, particularly the meaningful ones, you'll notice many commits. Some come from AI code reviews, but many come from my own code reviews or from me steering the design. I can't say I've audited everything line for line, but I can comfortably say that it's not exfiltrating your data or doing anything evil.

If you are uncomfortable using this integration because of concerns around AI, I completely understand and that is your prerogative. If you ever want to chat about it — whether it's to convince me that what I'm doing is wrong, to learn more about it, or anything in between — find me on the Home Assistant Discord.

About

Lock code manager for locks integrated with Home Assistant

Topics

Resources

Stars

102 stars

Watchers

4 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

1,041 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Lock Code Manager

Lock Code Manager scales down to a simple UI for managing your lock's PIN codes — and scales up to a programmable, multi-lock, multi-provider PIN platform with scheduled access, condition-driven activation, and automation-ready services. Define your codes once and LCM handles setting, clearing, and monitoring them on every lock, across providers (Z-Wave, ZHA, Matter, and more) without you wiring up the differences.

Whether you just want a clean dashboard for your front door or you're rotating PINs across an Airbnb fleet on a nightly schedule, LCM has you covered.

Features:

  • Give each person a name and a PIN; Lock Code Manager works out which slot on which lock they land in
  • Synchronize PIN codes across multiple locks and providers
  • Automatic sync — codes are set and cleared as needed, with retry and drift detection
  • Condition entities control when a code is active:
    • calendar — active during events
    • binary_sensor / switch / input_boolean — active when on
    • schedule — active during scheduled times
  • Services and actions for adding and removing users, setting/clearing PINs, attaching condition entities, hard-refreshing from the lock, and generating safe random PINs from automations
  • Blueprints for advanced use cases like usage limiting, calendar-driven PINs, and more
  • Check codes entered somewhere Lock Code Manager doesn't control — a do-it-yourself ESPHome keypad, an intercom — against the same users and schedules, and record the use like any other
  • Guest and rental workflows — rotate a standing user per booking, or add and remove them per stay
  • Dashboard strategies and custom cards for managing codes and viewing lock status — from one-line auto-generated dashboards to fully hand-composed layouts

Supported lock integrations:

IntegrationRead PINsPush UpdatesCode EventsNotes
Z-WaveVariesSome locks mask PINs
ZHADrift detection fallback if lock lacks programming events
Zigbee2MQTT (MQTT)²VariesSame broker as Z2M; PIN support depends on lock
Z-Wave JS UI (MQTT)³VariesLocks bridged via zwave-js-ui's MQTT gateway; some locks mask PINs
MatterPINs write-only per spec
Schlage WiFiCloud-based, PINs masked
Akuvox¹Local API, polling-based
Virtual¹A credential store rather than a device: records uses reported by the use_credential action, and lets you try Lock Code Manager without a real lock

¹ Custom integration required (Local Akuvox, hass-virtual)

² Zigbee2MQTT (MQTT) — Pair the lock in Zigbee2MQTT with PIN/user-code support for your firmware. The Code Events column refers to PIN-used automations from Lock Code Manager’s event entity (which slots were used to lock/unlock). Zigbee2MQTT lock/unlock actions with user identification are mapped to code slot events for PIN-used automations. Configure Home Assistant’s MQTT integration on the same broker Zigbee2MQTT uses. Custom Zigbee2MQTT base topics — including multi-level topics (e.g. home/z2m) and multiple bridges on one broker — are supported automatically: Lock Code Manager reads each lock’s exact MQTT topic from the discovery data Zigbee2MQTT publishes to Home Assistant, so no extra configuration is needed. Locks must be added to Home Assistant via MQTT discovery (Zigbee2MQTT’s default). During LCM setup, choose your lock.* entity from MQTT.

³ Z-Wave JS UI (MQTT) — For Z-Wave locks exposed to Home Assistant through zwave-js-ui's MQTT discovery gateway rather than the official websocket integration (which the Z-Wave row covers, and which zwave-js-ui itself recommends — switching needs no re-pairing). Reads and writes go through zwave-js-ui's MQTT api; gateway type Named or ValueID gives full functionality including push updates and PIN-used events, while Manual runs polling-only. Configure Home Assistant’s MQTT integration on the same broker zwave-js-ui uses.

Adding support for new lock integrations is straightforward — see the Adding a Provider guide. Contributors welcome!

Integrations That Cannot Currently Be Supported

Some lock integrations cannot currently be supported due to limitations in their underlying libraries. See the wiki for details.

Condition Entity Integrations Not Supported

Some integrations create entities whose states don't map to LCM condition entity semantics ("access allowed" / "access denied"). The integration may still be usable with LCM by driving slot Enabled switches from its own automation logic instead of attaching its entities as condition entities. See the wiki for details and the scheduler-component workaround.

Installation

The best way to install this integration is via HACS.

  1. Set up your locks in Home Assistant through a supported integration (Z-Wave, ZHA, Matter, Schlage, Zigbee2MQTT/MQTT, etc.)
  2. Add this repository as a custom integration repository in HACS
  3. Go to Settings > Devices & Services > Add Integration
  4. Select Lock Code Manager
  5. Follow the prompts - additional information about the configuration options are available in the Wiki

Blueprints

Pre-built automations and templates for common lock management patterns. See BLUEPRINTS.md for full details, input tables, and import buttons.

Template blueprints

  • Calendar Condition — Binary sensor for calendar-based access
  • Date Range Condition — Binary sensor for start/end date access

Automation blueprints

  • Slot Usage Limiter — Disable a user after a set number of uses
  • Calendar PIN Setter — Extract and set PINs from calendar events
  • Auto Re-lock — Re-lock after a delay with day/night support
  • Lock on Door Close — Lock when a door sensor detects closure
  • Slot Usage Notifier — Notify when someone's credential is used
  • Credential Used — Run any actions when a credential is used, from a lock's own keypad or an external one
  • Condition Linker — Assign a condition entity to a user via UI

Learn More

Visit the Wiki for detailed documentation including configuration, troubleshooting, dashboard setup, and development guides.

Upgrading from 4.x? 5.0 is configured by user rather than by slot number, and migrating renames every entity ID. Read Upgrading to 5.0 first — the migration is one-way.

UI & Dashboards

Lock Code Manager ships custom Lovelace strategies (which auto-generate UI from your config) and custom cards (which you compose yourself). Pick the one that matches how much control you want — from a one-click dashboard that just works (selectable directly from Settings → Dashboards → Add Dashboard on Home Assistant 2026.5+) to a hand-authored layout that places exactly what you want where you want it.

AI Usage

While I began this project before AI coding agents and wrote the bones myself, since November 2025 it's been hard NOT to code with a coding agent. You will notice that almost all of my PRs since then have been co-authored with Claude (I've also experimented with Codex and Copilot).

If you look at any of the PRs, particularly the meaningful ones, you'll notice many commits. Some come from AI code reviews, but many come from my own code reviews or from me steering the design. I can't say I've audited everything line for line, but I can comfortably say that it's not exfiltrating your data or doing anything evil.

If you are uncomfortable using this integration because of concerns around AI, I completely understand and that is your prerogative. If you ever want to chat about it — whether it's to convince me that what I'm doing is wrong, to learn more about it, or anything in between — find me on the Home Assistant Discord.

About

Lock code manager for locks integrated with Home Assistant

Topics

Resources

Stars

102 stars

Watchers

4 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Latest commit

History

1,041 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Lock Code Manager

Lock Code Manager scales down to a simple UI for managing your lock's PIN codes — and scales up to a programmable, multi-lock, multi-provider PIN platform with scheduled access, condition-driven activation, and automation-ready services. Define your codes once and LCM handles setting, clearing, and monitoring them on every lock, across providers (Z-Wave, ZHA, Matter, and more) without you wiring up the differences.

Whether you just want a clean dashboard for your front door or you're rotating PINs across an Airbnb fleet on a nightly schedule, LCM has you covered.

Features:

  • Give each person a name and a PIN; Lock Code Manager works out which slot on which lock they land in
  • Synchronize PIN codes across multiple locks and providers
  • Automatic sync — codes are set and cleared as needed, with retry and drift detection
  • Condition entities control when a code is active:
    • calendar — active during events
    • binary_sensor / switch / input_boolean — active when on
    • schedule — active during scheduled times
  • Services and actions for adding and removing users, setting/clearing PINs, attaching condition entities, hard-refreshing from the lock, and generating safe random PINs from automations
  • Blueprints for advanced use cases like usage limiting, calendar-driven PINs, and more
  • Check codes entered somewhere Lock Code Manager doesn't control — a do-it-yourself ESPHome keypad, an intercom — against the same users and schedules, and record the use like any other
  • Guest and rental workflows — rotate a standing user per booking, or add and remove them per stay
  • Dashboard strategies and custom cards for managing codes and viewing lock status — from one-line auto-generated dashboards to fully hand-composed layouts

Supported lock integrations:

IntegrationRead PINsPush UpdatesCode EventsNotes
Z-WaveVariesSome locks mask PINs
ZHADrift detection fallback if lock lacks programming events
Zigbee2MQTT (MQTT)²VariesSame broker as Z2M; PIN support depends on lock
Z-Wave JS UI (MQTT)³VariesLocks bridged via zwave-js-ui's MQTT gateway; some locks mask PINs
MatterPINs write-only per spec
Schlage WiFiCloud-based, PINs masked
Akuvox¹Local API, polling-based
Virtual¹A credential store rather than a device: records uses reported by the use_credential action, and lets you try Lock Code Manager without a real lock

¹ Custom integration required (Local Akuvox, hass-virtual)

² Zigbee2MQTT (MQTT) — Pair the lock in Zigbee2MQTT with PIN/user-code support for your firmware. The Code Events column refers to PIN-used automations from Lock Code Manager’s event entity (which slots were used to lock/unlock). Zigbee2MQTT lock/unlock actions with user identification are mapped to code slot events for PIN-used automations. Configure Home Assistant’s MQTT integration on the same broker Zigbee2MQTT uses. Custom Zigbee2MQTT base topics — including multi-level topics (e.g. home/z2m) and multiple bridges on one broker — are supported automatically: Lock Code Manager reads each lock’s exact MQTT topic from the discovery data Zigbee2MQTT publishes to Home Assistant, so no extra configuration is needed. Locks must be added to Home Assistant via MQTT discovery (Zigbee2MQTT’s default). During LCM setup, choose your lock.* entity from MQTT.

³ Z-Wave JS UI (MQTT) — For Z-Wave locks exposed to Home Assistant through zwave-js-ui's MQTT discovery gateway rather than the official websocket integration (which the Z-Wave row covers, and which zwave-js-ui itself recommends — switching needs no re-pairing). Reads and writes go through zwave-js-ui's MQTT api; gateway type Named or ValueID gives full functionality including push updates and PIN-used events, while Manual runs polling-only. Configure Home Assistant’s MQTT integration on the same broker zwave-js-ui uses.

Adding support for new lock integrations is straightforward — see the Adding a Provider guide. Contributors welcome!

Integrations That Cannot Currently Be Supported

Some lock integrations cannot currently be supported due to limitations in their underlying libraries. See the wiki for details.

Condition Entity Integrations Not Supported

Some integrations create entities whose states don't map to LCM condition entity semantics ("access allowed" / "access denied"). The integration may still be usable with LCM by driving slot Enabled switches from its own automation logic instead of attaching its entities as condition entities. See the wiki for details and the scheduler-component workaround.

Installation

The best way to install this integration is via HACS.

  1. Set up your locks in Home Assistant through a supported integration (Z-Wave, ZHA, Matter, Schlage, Zigbee2MQTT/MQTT, etc.)
  2. Add this repository as a custom integration repository in HACS
  3. Go to Settings > Devices & Services > Add Integration
  4. Select Lock Code Manager
  5. Follow the prompts - additional information about the configuration options are available in the Wiki

Blueprints

Pre-built automations and templates for common lock management patterns. See BLUEPRINTS.md for full details, input tables, and import buttons.

Template blueprints

  • Calendar Condition — Binary sensor for calendar-based access
  • Date Range Condition — Binary sensor for start/end date access

Automation blueprints

  • Slot Usage Limiter — Disable a user after a set number of uses
  • Calendar PIN Setter — Extract and set PINs from calendar events
  • Auto Re-lock — Re-lock after a delay with day/night support
  • Lock on Door Close — Lock when a door sensor detects closure
  • Slot Usage Notifier — Notify when someone's credential is used
  • Credential Used — Run any actions when a credential is used, from a lock's own keypad or an external one
  • Condition Linker — Assign a condition entity to a user via UI

Learn More

Visit the Wiki for detailed documentation including configuration, troubleshooting, dashboard setup, and development guides.

Upgrading from 4.x? 5.0 is configured by user rather than by slot number, and migrating renames every entity ID. Read Upgrading to 5.0 first — the migration is one-way.

UI & Dashboards

Lock Code Manager ships custom Lovelace strategies (which auto-generate UI from your config) and custom cards (which you compose yourself). Pick the one that matches how much control you want — from a one-click dashboard that just works (selectable directly from Settings → Dashboards → Add Dashboard on Home Assistant 2026.5+) to a hand-authored layout that places exactly what you want where you want it.

AI Usage

While I began this project before AI coding agents and wrote the bones myself, since November 2025 it's been hard NOT to code with a coding agent. You will notice that almost all of my PRs since then have been co-authored with Claude (I've also experimented with Codex and Copilot).

If you look at any of the PRs, particularly the meaningful ones, you'll notice many commits. Some come from AI code reviews, but many come from my own code reviews or from me steering the design. I can't say I've audited everything line for line, but I can comfortably say that it's not exfiltrating your data or doing anything evil.

If you are uncomfortable using this integration because of concerns around AI, I completely understand and that is your prerogative. If you ever want to chat about it — whether it's to convince me that what I'm doing is wrong, to learn more about it, or anything in between — find me on the Home Assistant Discord.

About

Lock code manager for locks integrated with Home Assistant

Topics

Resources

Stars

102 stars

Watchers

4 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages