iantrich / restriction-card

🔒 Apply restrictions to Lovelace cards
MIT License
254 stars 22 forks source link

Conditional lock on foreign state #78

Closed jzielke84 closed 1 year ago

jzielke84 commented 1 year ago

Hi,

I just can not get my head around on how to lock when a state of another object changes:

  - type: custom:restriction-card
    restrictions:
      block: |
        [[[
          if (binary_sensor.fenster_arbeitszimmer_iaszone == 'on')
            return 'true';
          return 'false';
        ]]]
    card:
      type: thermostat
      entity: climate.heizung_arbeitszimmer_thermostat

What am I doing wrong here?

jzielke84 commented 1 year ago

OK I finally solved it:

type: custom:restriction-card
restrictions:
  block:
    condition:
      entity: binary_sensor.fenster_arbeitszimmer_iaszone
      value: 'on'