Lovelace Restriction Card - Client-side Security

I’m assuming this is an answer to me.
And yes, this is the question.
I don’t understand where to put / configure the Theme Variables.
I haven’t found one example that can tell me this.

Thanks for answering, but these are not really answers at all.
First, I have never heard of themes before, and therefore I had no configuration for it.
And how is it logical to assume that configuration that applies to this specific card only goes into a global configuration file?

It is ok not to answer questions. Better that, than to “answer” questions.

I had a feeling that you may not be aware of themes after you ignored the first link I made to help you that linked to this (emphasis mine):

The following variables are available and can be set in your theme to change the appearance of the lock. Can be specified by color name, hexadecimal, rgb, rgba, hsl, hsla, basically anything supported by CSS.

So I linked to the Home Assistant themes document for you. Where you could read all about them.

Apologies if that was not clear enough for you.

Since you apparently have a card like this configured, why don’t you just copy / paste a few lines from that config, and this would have been answered a long time ago.

Thanks.

Because as I said many times already it does not go in the card, it goes in your theme. And as my theme makes extensive use of card mod it would just be confusing. But sure, here you go: Day and Night - #29 by tom_l

I just discovered by accident that this card seems to have a bug. If I hover my mouse slightly above the locked entity switch I get control.

Has anyone else noticed this?

Yeah I see that too. If you get it just on the edge of the touch radius:

Untitled

Here´s the issue you created :smiley:

I was wondering if I can apply restrictions to a button card with restriction card. Whenever trying I get something weird looking like this:

Therefore: which types of cards are supported @iantrich ?

All of them.

So how can I add it to a button card? Everything I tried ended up in… (see screenshot above Lovelace Restriction Card - Client-side Security - #138 by e-raser).

I never saw an example of restriction-card applied to a button card.

A good start would be sharing your attempted card config, rather than a screenshot.

I meanwhile managed to have it basically work and look like this (row was set to true… beginner´s fault):

type: custom:restriction-card
row: false
card:
  type: button
  tap_action:
    action: toggle
  entity: switch.kiosk_tablet_kiosk_lock
  show_state: false
  show_icon: true
  show_name: true
  name: Kiosk-Sperre
restrictions:
  confirm: null
  pin:
    code: 1234
    text: 'Gesperrter Bereich. PIN nötig:'
    retry_delay: 0
    max_retries: unlimited
    max_retries_delay: 0
    exemptions:
      - user: ######################
style: |
  :host {
    --restriction-lock-icon-size: 18px;
    --restriction-regular-lock-color: var(--accent-color);
    --restriction-success-lock-color: green;
    --restriction-lock-row-margin-left: 28px;
  }
  div#overlay {
    align-items: center;
  }

That button is embedded in a grid with setting

columns: 2
square: true

As you can see it looks different to the other buttons, so restriction-card behaves a bit different (it doesn´t respect/apply the square: true setting. Any idea how to fix that?

1 Like

Not that I would want to slow you down with this project of yours, but have you taken a look at custom:butto-card? :slight_smile:

It would offer this functionality with just two lines of code and seems more appropriate for your use case.

Why bother with another card, if you can have it all-in-one?

Just saying. :slight_smile:

Nice card, thanks. As far as I can see misses at least

  • complete blocking of an action
  • PIN for unlocking an action

…and it has some GUI issues as well.

So related to these features I still prefer custom:restriction-card.

I am really struggling here. I have tried everything I can think of but it isn’t working. I would rather not mess with Themes for now so I was trying to move the lock icon and color it red using card-mod but I just can’t get it to work.

type: custom:restriction-card
restrictions:
  confirm:
    text: Are you sure you want to toggle the HVAC systems?
card:
  style: |
    .card-header {
    font-size: 18px;
    padding: 2px 15px 2px 35px
    }
  title: Systems
  type: entities
  entities:
    - type: section
    - entity: light.downstairs_hvac
      icon: hass:hvac
      type: custom:multiple-entity-row
      toggle: true
      entities:
        - entity: sensor.downstairs_hvac_power
          name: ' '
    - entity: light.upstairs_hvac
      icon: hass:hvac
      type: custom:multiple-entity-row
      toggle: true
      entities:
        - entity: sensor.upstairs_hvac_power
          name: ' '

The style code in there is customized to move the “Systems” label over compared to the code used in all the other ones (see Sensors as an example). I would rather have “Systems” aligned with Sensors (thus using same style code), and move the Lock over to the right of the title.

At one point I was able to change the color of the text so I knew the style was doing something, but the restriction-card variables were not working.

AWESOME card by the way!! Love it!

1 Like

Is there any easy way to control the height?

I have 3 horizontal stacks with button cards and the restriction card has a different height than the button card. In the past I’ve used stuff like card-mod, but I’d like to get rid of that as much as possible because it always causes some kind of problems.

created the whole dashboard from scratch and the problem is gone

1 Like

I have been tearing my hair out. I have the simplest card, just trying to test it out. A basic block that shouldn’t matter to my user. When I go to interact with the card, I get the flashing lock and can’t do anything.

Apparently, I don’t know what user I am or something. Is there a special ID or something?

  • I have tried what is on the Profile page: Steve You are currently logged in as Steve. You are an owner.
  • I have tried it in quotes

I have no idea, what stupid thing am I missing or do I not understand exemptions? Any help would be appreciated. Thank you

type: custom:restriction-card
restrictions:
  block:
    exemptions:
      - user: Steve
card:
  type: thermostat
  entity: climate.icomfort

You need to use the user ID not username.

Untitled

2 Likes