Lovelace Restriction Card - Client-side Security

HACS now has v1.2.9 available for update. I just applied it over v1.2.8 and the lock-out over the whole cover.garage_door entity is working once again. Thank you for the update!!

2 Likes

Is it possible to have a restriction card block access, with a specific user exempt , that doesnt require the first card tap to unlock it??

At the moment, even though my user is excempt, I effectively need to tap twice to execute the action, first to unblock, and then second to do the action. Would be better (for my use case) if it didnt need the two taps.

beautiful card I appreciate your work
I would like to define code inside secret.yaml on card I set code on !secret but card goes wrong any solution?

      type: custom:restriction-card
      restrictions:
        pin:
          code: !secret secret_pin

and secrets are supported in yaml mode of dashboards only.

i get this error
unknown tag !<!secret> (5:28)

--------------------------------^
6 | block: null
7 | card:

5 | code: !secret code_card
--------------------------------^
6 | block: null
7 | card:

this code

type: custom:restriction-card
restrictions:
  confirm: null
  pin:
    code: !secret code_card
  block: null

!!!

:+1: :+1: Resolved yaml mode ā€¦ Thank you

hi, it would be nice to be able to implement the pin request the same as that of the home assistant person, without having to insert it into the card. This would make many things more convenient, each user can change it as they wish from their profile card and no code changes are needed in the card.

to give an idea something like this:

restrictions:
pin:
code by_user:
users:
- user: xxxxxxxxxxxxxxxxxxxxxx
- user: yyyyyyyyyyyyyyyyyyyyyy

What is a ā€œprofile cardā€?

thatā€™s what I meant:

So, you need a custom ā€œPINā€ field in the HA user settings to be used by this custom card, do you?

no, I would like the custom tab to use the home assistant profile password

Do you mean ā€œa custom cardā€?
Do not think that any card has (or should have) an access to this data.

P.S. what version of HA are you using?

Asked because your UI differs a lot from mineā€¦

since we donā€™t have an option to really lock our Tile cards natively (and I want to guard my garage door), I tried the restriction card, and I admit it doesnt look bad. Figured Iā€™d share, as I didnt find many examples for the combination restriction/tile cards myself:

only showing it to several users:

- type: conditional
  conditions:
    - condition: user
      users:
        - !secret admin_m
        - !secret admin_w
        - !secret user_m
  card:
    type: custom:restriction-card
    card:
      type: tile
      entity: cover.garage_deur
      state_content:
        - state
        - current_position
        - last-changed
    condition:
      entity: cover.garage_deur
      value: closed
    restrictions:
      confirm:
        text: 'Garagedeur openen?'
      pin:
        text: 'Voer Pincode in:'
        code: !secret tahoma_secret
        max_retries: 3
        max_retries_delay: 30

my restriction card variables are set globally in the themes:

    restriction-lock-row-margin-left: calc(100% - 25px) #95%
    restriction-regular-lock-color: var(--alert-color) #red
    restriction-lock-opacity: 0.8

Hey,
Is there a way that i protect my entities list
that we can toggle from off to on and that its locked if the switch is on

type: entities
entities:
  - entity: input_boolean.klus_1
  - entity: input_boolean.klus_2

how could i use the restrictions card in this case?
I use this as usecase that the kids can toogle tasks they have done but that they cannot switch off them selfs without the code only toggle on
Could anyone help me with the code? :slight_smile:

Hi can any help me to customize the ā€œlockā€ icon? Cannot solve it to geht the lock-icon allign right on the button with card_mod.
can anyone help me with this?

image

Below my code:

type: custom:restriction-card
restrictions:
  confirm: null
  pin:
    text: Please enter Pin-Code to access
    code: 12345
card:
  type: custom:button-card
  name: TEST
  aspect_ratio: 4/0.9
  icon: mdi:lan
  tap_action:
    action: navigate
    navigation_path: /dashboard
  card_mod:
    style: |
      ha-card {
      background: rgba(0,0,0,0.1);
      width: 35% !important;
      height: 100% !important;
      margin-left: 65%; !important;
      }

Hey,

im very confused with this card and pretty sure im using it wrong. All im trying to do is blocking a card based on a template-based binary_sensor.

type: custom:restriction-card
restrictions:
  block:
    condition:
      entity: binary_sensor.nas_is_up
      state: 'on'
card:
  type: entities
  entities: []

I tryed out many variations. With and without the ā€œblockā€. Putting it into the entities card. Setting it ture or falseā€¦

No matter what i do i cant lock this card based on my sensor. Some help would be great :slight_smile:

K, i think now i got it. There is no ā€œstateā€ i have to use ā€œvalueā€ and an "operator.
Should be something like this

type: custom:restriction-card
restrictions:
  block:
    condition:
      entity: binary_sensor.nas_is_up
      operator: '=='
      value: 'on'
card:
  type: entities
  entities: []

But tell me it its still not the way its supposed to be used :smiley: