Script if statment always false

Hello, my script returns always false but i doesn’t get why. If the light.podlaha_led is turned on 50% or something else it always says that both conditions are false.

Script:

alias: Led_Brightness
sequence:
  - if:
      - condition: and
        conditions:
          - condition: device
            type: is_on
            device_id: b05f1eaf3ade8e9c74v08d242b371b8e
            entity_id: light.podlaha_led
            domain: light
          - condition: numeric_state
            entity_id: light.podlaha_led
            attribute: brightness
            above: "15"
    then:
      - service: input_boolean.turn_on
        data: {}
        target:
          entity_id: input_boolean.podlaha_zapnuta_manualne
    else:
      - service: input_boolean.turn_off
        data: {}
        target:
          entity_id: input_boolean.podlaha_zapnuta_manualne
mode: single
icon: mdi:led-on

Debug ( light.podlaha_led was on 100%) :

Executed: 9. augusta 2022, 19:50:01
Result:
choice: else
if
Executed: 9. augusta 2022, 19:50:01
Result:
result: false
if/condition/0
Executed: 9. augusta 2022, 19:50:01
Result:
result: false
if/condition/0/conditions/0
Iteration 1
Executed: 9. augusta 2022, 19:50:01
Result:
result: false
if/condition/0/conditions/0
Iteration 2
Executed: 9. augusta 2022, 19:50:01
Result:
result: false
if/condition/0/conditions/0/entity_id/0
Executed: 9. augusta 2022, 19:50:01
Result:
result: false
state: 'off'
wanted_state: 'on'

I am trying to get the brightness value of the light.podlaha_led as a condition for my automation.

Thank you…

I solved my problem with a template in my automation.

template:

{% if states('light.podlaha_led') == 'on' %}
  {% if (state_attr('light.podlaha_led', 'brightness') / 255 * 100) | int > 15 %}
    false
  {% else %}
    true
  {% endif%}
{% else %}
  true
{% endif%}

I found it here Burmingstone answer

But i still want to know why the conditions doesn’t work.

In this solution is this type of problem

Does anyone knows why it doesn’t work. Thanks.

I’m guessing it is this, the Brighten Attribute does not exist until the light is turned on, so that throws a wrench in the mix.

If you are interested, you can reduce that template to this:

{{ not (is_state('light.podlaha_led', 'on') and 
  (state_attr('light.podlaha_led', 'brightness') / 255 * 100) | int(0) > 15)  }}

But i tested it after the light was on. And the first condition is only if “is_on” and that was also false.

Thanks. I will.