[solved] Conditional card, state_attr & check for brightness?

I’m trying to use the brightness of a light as the condition in a conditional card.
The template works but I cannot put it together.
Any help is highly appreciated!

type: conditional
conditions:
  - entity: '{{ state_attr(''light.l1'', ''brightness'') |int == 50}}'
    state: 'True'

You can’t use templates in a Conditional Card.

For that matter, you can’t use templates in most, if not all, of the standard Lovelace cards.

The workaround in your case would be to create a Template Binary Sensor (using the template you have) and then referring to it in the Conditional card

type: conditional
conditions:
  - entity: binary_sensor.light_is_50
    state: 'on'
1 Like

Hi Taras (@123 )
Thank you, this works! :clap: , :bow:

Is it easy to tell me where I could have found this - impossibility to use templates in Lovelace cards?

1 Like

Is it easy? I’ll have to say no because I first learned it from others and then confirmed it by scanning through the Lovelace card documentation and failing to find anything (or example) mentioning templates. However, there are custom cards that support templates. The auto-entities card comes to mind (mostly because it’s the only custom card I use).

1 Like

Ok, thank you again! :wink:

I do not just want to burden others to solve my puzzles but also learn, even if I have to be ashamed that I overlooked something.
I couldn’t find any example either but just thought to give it a try.

The idea/principle of creating sensors is new to me and afterwards it makes sense.