Light.turn_off form brightness

Sorry that my mother tongue is not English. If there is any inappropriate language in the narration, please forgive me.

I tried to add a condition judgment to the command. When the LED brightness is less than 20%, the system turns off the light, but I can’t find a way to check the brightness. The following is my description. You can give me suggestions. I will be very grateful.

  - platform: gpio
    device_class: light
    pin: D2
    id: led_touch
    internal: true
    on_press:
      then:
           - if:
            condition:
              or:
              - light.is_on: led_light
            then:
              - light.dim_relative:
                  id: led_light
                  relative_brightness: -20%
                  transition_length: 1.5s
              - delay: 0.2s
        - if:
            condition:
              or:
              - light.is_off: led_light
            then:
              - light.turn_on:
                  id: led_light
                  brightness: 100%
        - if:
            condition:
              lambda: |-
                return id(led_light).state < 20%;
            then:
              - light.turn_off: led_light

Instead of this:

return id(led_light).state < 20%;

try this:

return id(led_light).current_values.brightness < 0.20f;