Lovelace Restriction Card - Client-side Security

I have the following card setup.

type: entities
entities:
  - type: custom:restriction-card
    lock: false
    restrictions:
      pin:
        code: 1234
        text: Enter Pin Code
    duration: 20
    card_mod:
      style: |
        :host {
           --restriction-blocked-lock-color: red;
           --restriction-success-lock-color: green;
           --restriction-invalid--color: orange;
           --restriction-lock-icon-size: 22px;
           --restriction-lock-margin-left: calc(50% - 18px);
           --restriction-lock-row-margin-top: 10px;
         }       
    card:
      type: custom:paper-buttons-row
      base_config:
        style:
          button:
            font-size: 0.9rem
            background-color: rgba(62, 65, 75, 0.6)
            border-radius: 15px
            "--mdc-icon-size": 18px
      buttons:
        - entity: switch.adguard_home_parental_control
          state_icons:
            "off": mdi:magnify
            "on": mdi:magnify-expand
          state_styles:
            "on":
              button:
                background-color: rgba(13, 160, 53, 0.3)
                color: rgba(20, 200, 60, 1)
            "off":
              button:
                background-color: rgba(62, 65, 75, 0.6)
                color: rgba(132, 135, 145, 1)
          name: Parental Control
          tooltip: false
          layout: icon_name
          tap_action:
            action: call-service
            service: switch.toggle
            service_data:
              entity_id: switch.adguard_home_parental_control
          style:
            button:
              height: 40px
              width: 110px
              margin-left: auto
              margin-right: auto
              margin-bottom: 10px
        - entity: switch.adguard_home_protection
          state_icons:
            "off": mdi:lock-open-variant-outline
            "on": mdi:lock-outline
          state_styles:
            "on":
              button:
                background-color: rgba(13, 160, 53, 0.3)
                color: rgba(20, 200, 60, 1)
            "off":
              button:
                background-color: rgba(62, 65, 75, 0.6)
                color: rgba(132, 135, 145, 1)
          name: AdGuard Protect
          tooltip: false
          layout: icon_name
          tap_action:
            action: call-service
            service: switch.toggle
            service_data:
              entity_id: switch.adguard_home_protection
          style:
            button:
              height: 40px
              width: 110px
              margin-left: auto
              margin-right: auto
              margin-bottom: 10px
 

WRT card-mod,
–restriction-blocked-lock-color
–restriction-success-lock-color: green
–restriction-lock-row-margin-top: 10px
have no effect.

–restriction-invalid–color: orange
worked before the last update (1.2.18), now reverts to red.

Also, lock icon now dissapears when locked, before the update, it remained when locked.

Have also tried adding to my theme, same result. Am I doing something wrong?
Many thanks


It is explicitly mentioned in release notes that this variable got a fixed name.
Suggest you use SIMPLER test cards for investigating issues, currently your code contains other custom plugins.

Got it. --restriction-invalid-lock-color now works. Thank you


Will try with a simpler card.

As for card-mod. Using restriction-card with card-mod is described in the main card-mod thread, ask there. To exclude card-mod from your investigation, suggest to place your css variables into a custom theme.

Can someone help me please.

Here is my code to have pin on an Yale lock

type: custom:hui-entities-card
show_header_toggle: false
title: Status
entities:
  - card:
      entity: lock.front_door
    type: custom:restriction-card
    restrictions:
      pin:
        code: 1234
    row: true

After clicking on the lock, I can enter the pin but nothing happens after the numbers are entered.

If I remove the PIN restriction

type: custom:hui-entities-card
show_header_toggle: false
title: Status
entities:
  - card:
      entity: lock.front_door
    type: custom:restriction-card
    row: true

I can lock/unlock the lock

What am I doing wrong?

Why not just “entities”?

Will not affect on custom rows.

The row is unlocked, doesn’t this happen?

Bonjour,

je souhaite verrouiller la carte de l’alarme par un code pin pour l’activation et dĂ©sactivation de celle ci.
Visiblement mon code ne marche pas, je n’ai pas de restriction.
Si quelqu’un peut m’aider.

type: custom:restriction-card
restrictions:
  pin:
  code:
    - 1001
  text: MDP pour debloquer
card:
  states:
    - arm_night
  type: alarm-panel
  entity: alarm_control_panel.somfy_home_alarm_maison_lespignan
  name: Alarme Maison

Please write in English, thank you.
Also, start with fixing indentation for a “code” line. And the “text” option is definitely not in it’s place.

with 2025.8 we get new Button elements styling in the cards. It reveals something I never noticed before:

      - type: custom:restriction-card
        row: true
        card_mod: !include /config/dashboard/card_mods/restriction_lock.yaml
        card:
          entity: script.reboot_iungo
          action_name: Reboot
        restrictions:
#           block: true
          confirm:
            text: Bevestig Iungo herstart?
      - entity: script.reboot_iungo
        action_name: Reboot

Somehow it takes away from the button elements available space on the right side. Because of that, the text is no longer centered.
Maybe some padding on the row, or another property, I didnt yet inspect too thoroughly.
can set a margin-right on the overlay in Inspector, but that just moves the shorter button, it doesnt make it as wide as the core button

Might be worth a look as it really makes the Buttons look bad

Will take a look when be near a pc.

Both labels are right-aligned, see no issue here:

type: entities
entities:
  - type: custom:restriction-card
    row: true
    card:
      entity: script.test_script
      action_name: test
    restrictions:
      confirm:
        text: confirm?
  - entity: script.test_script
    action_name: test test test
1 Like

Hello.
Is it possible to lock toggle (input_boolean) displayed on an entities card, in a way that clicking on the toggle raises a confirmation popup, and a positive answer toggles the toggle?

What I achieved is a confirmation pop-up that releases the lock, and then I need to click the toggle

type: entities
entities:
  - type: custom:restriction-card
    row: true
    condition:
      entity: input_boolean.pv_ctrl_edit_mode
      value: "off"
    restrictions:
      confirm:
        text: Are you sure?
    card:
      entity: input_boolean.pv_ctrl_edit_mode

thank you

As expected since these are 2 separate actions - unlock a card, do smth with a card.

Not possible currently since the confirmation is shown for the “Unlock” action.
The card may contain different controls (or could be a control itself - like a Button card), and changing a particular inner control automatically along with unlocking is just a tiny use-case out of many.

all of a sudden I see this in console

[RC] render() → bailing early (missing required state)

Scherm­afbeelding 2026-03-31 om 13.46.16

dont think I touched those configs in ages, so could it be an update took place
unless
 I moved back to release, and stopped using a manual edited card
 It now dawns on me . I think
 nope that was another. now where to start looking for an answer to this.

filed it, and downgrading to 1.2.19 fixes

only downside I see is the ancient confirmation dialog