Condition > before: sunrise not working as expected

I have an automation to turn on my exterior lights at a set time IF the set time is BEFORE sunrise.

Otherwise, the exterior lights should not turn on at all.

alias: 06:00 > Turn on exterior lights (IF before rise)
trigger:
  - platform: time
    at: input_datetime.wake_up_time
condition:
  - condition: sun
    before: sunrise
action:
  - service: light.turn_on
    data:
      brightness_pct: 100
    target:
      entity_id:
        - light.light_all_exterior_lights
mode: single

And yet, the lights turn on every morning.

[This morning my wake time was 05:45 AM but sunrise was at 04:52 AM here]

06:00 > Turn on exterior lights (IF before rise) triggered by time set in Wake up time

5:45:00 AM - 2 hours ago

String Lights 02 turned on triggered by automation Turn on exterior lights (IF before rise) triggered by time set in Wake up time

5:45:01 AM - 2 hours ago

Patio lights Socket 1 turned on triggered by automation Turn on exterior lights (IF before rise) triggered by time set in Wake up time

5:45:01 AM - 2 hours ago

etc.

What am I doing wrong?

Try using a state condition for sun.sun to be below_horizon. Seems to be more reliable.

I replaced my condition with your suggestion:

condition:
  - condition: state
    entity_id: sun.sun
    state: below_horizon

Fingers crossed . Thank you for the tip.