Skip to content

Add a UI for lock code management

raman325 edited this page Jan 12, 2026 · 8 revisions

Add a UI for lock code management

Lock Code Manager provides custom Lovelace strategies and cards for managing PINs directly from your Home Assistant dashboard.

Dashboard

The easiest way to get started is to create a dedicated dashboard using the Lock Code Manager strategy. This automatically generates views for each of your LCM config entries.

Creating the Dashboard

  1. Go to Settings > Dashboards > Add Dashboard
  2. Choose a name (e.g., "Lock Codes") and icon
  3. Open the dashboard and click the pencil icon to edit
  4. Click the three dots menu and select Raw configuration editor
  5. Replace the content with:
strategy:
  type: custom:lock-code-manager

Dashboard Options

Option Required Default Description
use_slot_cards No true Use streamlined slot cards instead of legacy entities cards
show_code_sensors No true Show code sensors in lock status section
show_conditions No true Show conditions section in slot cards
show_lock_status No true Show lock status section in slot cards
show_lock_sync No true Show sync status per lock in lock status
collapsed_sections No [] Which sections start collapsed (empty = all expanded)
show_per_configuration_lock_cards No true Show lock cards in per-config-entry views
show_all_lock_cards_view No true Add a "User Codes" view with cards showing all lock codes
code_display No masked_with_reveal Code visibility mode for slot cards and lock codes cards

Legacy options (still supported but deprecated):

  • include_code_slot_sensors → use show_code_sensors
  • include_in_sync_sensors → use show_lock_sync
  • code_data_view_code_display → use code_display
  • show_all_codes_for_locks → use show_all_lock_cards_view and/or show_per_configuration_lock_cards

Example Dashboard Configuration

strategy:
  type: custom:lock-code-manager
  show_all_lock_cards_view: true
  show_per_configuration_lock_cards: true
  code_display: masked_with_reveal
  show_lock_sync: true

View Strategy

If you want to add Lock Code Manager to an existing dashboard, you can use the view strategy for a single config entry.

View Options

Option Required Default Description
config_entry_id Yes* - Config entry ID to render (use this OR config_entry_title)
config_entry_title Yes* - Config entry title to render (use this OR config_entry_id)
use_slot_cards No true Use streamlined slot cards instead of legacy entities cards
show_code_sensors No true Show code sensors in lock status section
show_conditions No true Show conditions section in slot cards
show_lock_status No true Show lock status section in slot cards
show_lock_sync No true Show sync status per lock in lock status
collapsed_sections No [] Which sections start collapsed (empty = all expanded)
show_lock_cards No true Append lock codes cards below the slot cards
code_display No masked_with_reveal Code visibility mode for slot cards and lock codes cards

*Either config_entry_id or config_entry_title is required, but not both.

Legacy options (still supported but deprecated):

  • include_code_slot_sensors → use show_code_sensors
  • include_in_sync_sensors → use show_lock_sync
  • code_data_view_code_display → use code_display
  • show_all_codes_for_locks → use show_lock_cards

Example View Configuration

views:
  - strategy:
      type: custom:lock-code-manager
      config_entry_title: House Locks
    icon: mdi:lock-smart
    title: Lock Codes

Section Strategies

For advanced users building custom sections-type views, Lock Code Manager provides section strategies that generate cards when Home Assistant renders the section.

Note: Section strategies simply render a single card (lcm-slot or lcm-lock-codes) within a grid section. You can use the cards directly in your dashboard without using section strategies - see Custom Cards below.

Slot Section Strategy (custom:lock-code-manager-slot)

Renders a single slot section with either the new lcm-slot card or legacy entities card.

Option Required Default Description
config_entry_id Yes - Config entry ID for the LCM instance
slot Yes - Slot number to display
use_slot_cards No true Use new lcm-slot card (true) or legacy entities card
code_display No masked_with_reveal Code visibility mode
show_conditions No true Show conditions section
show_lock_status No true Show lock status section
show_code_sensors No true Show code sensors in lock status
show_lock_sync No true Show sync status per lock
collapsed_sections No [] Sections to collapse by default: conditions, lock_status

Example:

views:
  - type: sections
    title: Lock Codes
    sections:
      - strategy:
          type: custom:lock-code-manager-slot
          config_entry_id: 1234567890abcdef
          slot: 1
          code_display: masked_with_reveal
      - strategy:
          type: custom:lock-code-manager-slot
          config_entry_id: 1234567890abcdef
          slot: 2

Lock Section Strategy (custom:lock-code-manager-lock)

Renders a lock codes section showing all slots for a specific lock.

Option Required Default Description
lock_entity_id Yes - The entity ID of the lock
code_display No masked_with_reveal Code visibility mode

Example:

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_door

Custom Cards

Lock Code Manager provides two custom cards that can be used independently or are automatically included by the strategies.

Slot Card (custom:lcm-slot)

The slot card displays a single code slot with inline editing, real-time WebSocket updates, and collapsible sections. This is the default card used by the strategies.

Features:

  • Inline editing for name, PIN, and enabled toggle
  • Real-time updates via WebSocket
  • Collapsible conditions and lock status sections
  • Status badges showing active/inactive/disabled state
  • Per-lock sync status

Configuration:

Option Required Default Description
config_entry_id Yes* - Config entry ID for the LCM instance
config_entry_title Yes* - Config entry title (alternative to ID)
slot Yes - Slot number to display
code_display No masked_with_reveal How to display codes (see below)
show_conditions No true Show the conditions section
show_lock_status No true Show the lock status section
show_code_sensors No true Show code sensors in lock status
show_lock_sync No true Show sync status per lock
collapsed_sections No [] Which sections start collapsed (empty = all expanded)

*Either config_entry_id or config_entry_title is required, but not both.

Example:

type: custom:lcm-slot
config_entry_id: 1234567890abcdef
slot: 1
code_display: masked_with_reveal
collapsed_sections:
  - lock_status

Lock Codes Card (custom:lcm-lock-codes)

The lock codes card displays all code slots for a specific lock. It shows status badges, supports inline editing for unmanaged slots, and provides click-to-navigate for LCM-managed slots.

Features:

  • Shows all slots on a lock with their current codes
  • Status badges (Active, Inactive, Disabled, Empty)
  • Sync status indicators
  • Inline editing for slots not managed by LCM
  • Click managed slots to navigate to their config entry
  • Reveal button for masked codes

Configuration:

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 masked_with_reveal How to display codes (see below)

Example:

type: custom:lcm-lock-codes
lock_entity_id: lock.front_door
title: Front Door Codes
code_display: masked_with_reveal

Code Display Modes

Both cards support three code display modes:

Mode Description
masked Codes are always hidden (shown as bullets)
unmasked Codes are always visible
masked_with_reveal Codes are masked but can be revealed with a toggle button (default)

Legacy Mode

If you prefer the old entities-card based UI, set use_slot_cards: false in your strategy configuration:

strategy:
  type: custom:lock-code-manager
  use_slot_cards: false
  include_code_slot_sensors: true

Note: When using legacy mode (use_slot_cards: false), installing the fold-entity-row card provides a cleaner UI by collapsing related entities into expandable rows.

Example

dashboard

Clone this wiki locally