Lovelace: Entity interlock

I’ve been using HA for some time and I am now needing more from Lovelace but I don’t really understand how to create custom cards.

I want to create a custom card that overlays a padlock on top of an entity (much like what thomasloven did with his toggle-lock-entity-row).

The difference is that the lock should be linked to the state of an “interlock” entity. If the interlock entity state is “on”, the entity shown should have the padlock overlay and no action should be triggered when it is clicked. When the interlock entity is “off”, the entity shown should behave normally. When the interlock entity is toggled, the padlock should be faded on or off.

The point of this card is to show that the control of a shown entity if controlled by an interlock entity.

I have been trying to modify thomasloven’s toggle-lock-entity-row code to make it work without any success.

Any help would be appreciated. Thanks.

It’s a great idea for a card and I hope you get the help you need. I’m no use unfortunately.

I was going to move this to the development category but it will get more exposure here and someone may come up with a way to do it with existing cards.

Maybe using card-mod’s style and tap action functions in combination with card-templater?

Hi @poberth, i’m looking for the same thing, have you found how to do it ?

I’ve not done it but I’m pretty sure you can do this with the condition option of the restriction card:

In the end, I am using the Restriction Card from HACS.

The documentation is not always clear but here is the code that works for me:

  - card:
      entity: switch.relay_1
    condition:
      entity: switch.automatic_mode
      value: 'on'
    restrictions:
      block: true
    row: true
    type: 'custom:restriction-card'

Hope this helps.

1 Like

Thanks will try this

@poberth @tom_l

works like a charm :slight_smile:

Thanks again for your help.

For information, my code :

entities:
  - entity: sensor.time
  - card:
      entity: input_boolean.machine_depart
    condition:
      entity: input_boolean.machine_fin
      value: 'on'
    restrictions:
      block: true
    type: 'custom:restriction-card'
    row: true
  - entity: input_datetime.depart_machine
  - card:
      entity: input_boolean.machine_fin
    condition:
      entity: input_boolean.machine_depart
      value: 'on'
    restrictions:
      block: true
    type: 'custom:restriction-card'
    row: true
  - entity: input_datetime.fin_machine
  - entity: switch.d1m_machine_a_laver
show_header_toggle: false
title: Machine à laver
type: entities

give this :

snip_20200513205145

Hi

I’ve switched from toggle-lock-entity-row to restriction-card, but I don’t understand how it works the lock.

With previous card, I just click one time and the lock opens and then I can toggle the entity

With this one, when I click one time I just see the lock blink ones and if I click the entity nothing happens and the lock turn again and fast on.

Is it the my code correct?

              - card:
                  entity: light.osram_1
                restrictions:
                  block: true
                type: "custom:restriction-card"
                row: true

I don’t want to have any condition, just a simple lock.

Thanks