-
-
Notifications
You must be signed in to change notification settings - Fork 14
UI Strategies
Strategies are Lovelace generators: you write a small block of YAML, and Home Assistant calls into Lock Code Manager at render time to produce the views, sections, and cards. The strategy reads your LCM config entries directly, so it stays in sync as slots and locks are added or removed without you having to edit the dashboard.
LCM ships four strategies, all under the custom:lock-code-manager* family. They differ in what scope of your LCM data they render:
| Strategy | Scope | Output |
|---|---|---|
| Dashboard strategy | The entire integration — every LCM config entry it discovers | A full dashboard: one view per config entry, plus an optional User Codes view aggregating every lock |
| View strategy | A single config entry | One view containing slot cards (and optionally lock-codes cards) for that entry |
| Slot section strategy | A single slot in a single config entry | One slot card inside a sections-type view |
| Lock section strategy | A single lock entity | One lock-codes card inside a sections-type view |
In practical terms: pick the dashboard strategy if you want LCM to own a whole dashboard end-to-end. Pick the view strategy if you have multiple config entries (e.g. one for House, one for Guest cottage) but only want one of them on a particular dashboard. Pick the section strategies for surgical placement alongside non-LCM cards.
For the user-facing decision guide, see Add a UI for lock code management.
Type: custom:lock-code-manager
Generates a complete dashboard:
- One view per LCM config entry (slot cards stacked, optionally followed by lock-codes cards).
- An optional User Codes view containing one lock-codes card per managed lock.
strategy:
type: custom:lock-code-managerHA 2026.5+: the dashboard strategy registers itself with Home Assistant's dashboard picker, so you can also add it from Settings → Dashboards → Add Dashboard by selecting Lock Code Manager from the strategy list. That picker uses default options — drop into the Raw configuration editor with the YAML above to customize them. See Add a UI for lock code management.
| Option | Type | Default | Description |
|---|---|---|---|
code_display |
masked | unmasked | masked_with_reveal
|
masked_with_reveal |
Code-display mode applied to every slot card and lock-codes card. See Custom Cards#code-display-modes. |
use_slot_cards |
bool | true |
Use the modern slot card. Set false for the pre-2.0 entities-card layout (see Legacy mode). |
show_conditions |
bool | true |
Show the Conditions section in slot cards. |
show_lock_status |
bool | true |
Show the Lock status section in slot cards. |
show_code_sensors |
bool | true |
Within Lock status, show the actual on-lock code sensor. |
show_lock_sync |
bool | true |
Within Lock status, show per-lock sync state (in-sync, out-of-sync, syncing, suspended). |
collapsed_sections |
array of condition | conditions | lock_status
|
[] |
Sections that start collapsed in slot cards. (Both condition and conditions are accepted for the conditions section.) |
show_per_configuration_lock_cards |
bool | true |
Append lock-codes cards to each per-config-entry view. |
show_all_lock_cards_view |
bool | true |
Add the User Codes view that shows every lock's full code list. |
condition_helpers |
Record<config_entry_id, Record<slot_num, entity_id[]>> |
none | Extra helper entity IDs (toggles, schedules, etc.) shown alongside the configured condition entity inside the slot card. Lets users flip helpers from the dashboard without editing the slot. |
These still work as backward-compatibility aliases but should be replaced:
| Deprecated | Use instead |
|---|---|
include_code_slot_sensors |
show_code_sensors |
include_in_sync_sensors |
show_lock_sync |
code_data_view_code_display |
code_display |
show_all_codes_for_locks |
show_all_lock_cards_view and/or show_per_configuration_lock_cards
|
strategy:
type: custom:lock-code-manager
code_display: masked_with_reveal
show_all_lock_cards_view: true
show_per_configuration_lock_cards: false
collapsed_sections:
- lock_status
condition_helpers:
01HZK9X4GR3PQ8YFAB6V0CZ7TM:
4: [input_boolean.guest_arrived, schedule.guest_quiet_hours]Type: custom:lock-code-manager (in a views[].strategy slot)
Generates a single view for one config entry. Use this to add LCM into a dashboard you already maintain.
views:
- strategy:
type: custom:lock-code-manager
config_entry_title: House Locks
icon: mdi:lock-smart
title: Lock CodesEither config_entry_id or config_entry_title is required — not both.
| Option | Type | Default | Description |
|---|---|---|---|
config_entry_id |
string | — | LCM config entry ID. Use this for stability across renames. |
config_entry_title |
string | — | LCM config entry title. Convenient for hand-edited YAML. |
code_display |
masked | unmasked | masked_with_reveal
|
masked_with_reveal |
Code-display mode for every card the view emits. |
use_slot_cards |
bool | true |
Use the modern slot card vs. legacy entities cards. |
show_conditions |
bool | true |
Show the Conditions section in slot cards. |
show_lock_status |
bool | true |
Show the Lock status section in slot cards. |
show_code_sensors |
bool | true |
Show the on-lock code sensor inside Lock status. |
show_lock_sync |
bool | true |
Show per-lock sync state inside Lock status. |
collapsed_sections |
array of condition | conditions | lock_status
|
[] |
Sections that start collapsed. |
show_lock_cards |
bool | true |
Append lock-codes cards below the slot cards. |
condition_helpers |
Record<slot_num, entity_id[]> |
none | Extra helper entity IDs to surface in each slot card, keyed by slot number. |
| Deprecated | Use instead |
|---|---|
include_code_slot_sensors |
show_code_sensors |
include_in_sync_sensors |
show_lock_sync |
code_data_view_code_display |
code_display |
show_all_codes_for_locks |
show_lock_cards |
For dashboards using type: sections views, LCM provides two strategies that each emit a single card inside a grid section. They're a thin wrapper over the corresponding custom card — useful when you want strategy-style auto-resolution of types but in a hand-built sections layout. If you'd rather just place the cards directly, use them from Custom Cards.
Type: custom:lock-code-manager-slot
Renders a single slot card.
| Option | Type | Default | Description |
|---|---|---|---|
config_entry_id |
string | — (required) | LCM config entry that owns the slot. |
slot |
int | — (required) | Slot number to render. |
code_display |
masked | unmasked | masked_with_reveal
|
masked_with_reveal |
Code-display mode. |
use_slot_cards |
bool | true |
Use the modern slot card vs. legacy entities card. |
show_conditions |
bool | true |
Show the Conditions section. |
show_lock_status |
bool | true |
Show the Lock status section. |
show_code_sensors |
bool | true |
Show the on-lock code sensor inside Lock status. |
show_lock_sync |
bool | true |
Show per-lock sync state inside Lock status. |
show_lock_count |
bool | true |
Show the lock-count badge in the card header. |
collapsed_sections |
array of condition | conditions | lock_status
|
[] |
Sections that start collapsed. |
condition_helpers |
array of entity IDs | none | Extra helper entities surfaced inside the slot card. |
views:
- type: sections
title: Lock Codes
sections:
- strategy:
type: custom:lock-code-manager-slot
config_entry_id: 01HZK9X4GR3PQ8YFAB6V0CZ7TM
slot: 1
- strategy:
type: custom:lock-code-manager-slot
config_entry_id: 01HZK9X4GR3PQ8YFAB6V0CZ7TM
slot: 2
collapsed_sections: [lock_status]Type: custom:lock-code-manager-lock
Renders a single lock-codes card.
| Option | Type | Default | Description |
|---|---|---|---|
lock_entity_id |
lock entity | — (required) | The lock to display codes for. |
code_display |
masked | unmasked | masked_with_reveal
|
masked_with_reveal |
Code-display mode. |
views:
- type: sections
title: All Lock Codes
sections:
- strategy:
type: custom:lock-code-manager-lock
lock_entity_id: lock.front_door
code_display: masked
- strategy:
type: custom:lock-code-manager-lock
lock_entity_id: lock.back_doorSetting use_slot_cards: false on the dashboard, view, or slot-section strategy falls back to the pre-2.0 layout, which uses Home Assistant's stock entities cards instead of the modern slot card. This exists for users who hand-customized the old layout and aren't ready to migrate.
strategy:
type: custom:lock-code-manager
use_slot_cards: false
show_code_sensors: trueRecommended add-on: install the fold-entity-row custom card. The legacy layout looks much cleaner with collapsible related-entity rows.
Legacy mode receives bug fixes but no new features — condition_helpers, show_lock_count, and the modern sync-status display are slot-card-only.
Getting Started
UI
- Add a UI for lock code management — overview & decision guide
- UI Strategies
- Custom Cards
Features
- Services and Actions
- Blueprints
- Tracking lock state change events
- Using Condition Entities
- Unsupported Condition Entities
- Notifications
Advanced
Development
Troubleshooting
FAQ
Supported Integrations