Automation executed without an actual trigger

Today I woke up finding my lights were turned on by Home Assistant.
Looking through my automations what triggered them being on, I found my ‘sunset’ automation triggered @ July 14, 2021, 6:25 AM. When I reviewed the trace, it looks like it started from the 3rd condition, without the trigger actually being triggered and without the first 2 conditions actually being true. Am I looking at this incorrectly? How can an automation be triggered without appropriate trigger value, get through 2 untrue conditions and still turn my lights on?

The automation only has one trigger, for which I see no reason to be triggered based on below:

For reference, my ‘sunset’ automation:

alias: Sunset
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.hue_motion_sensor_lightlevel
    below: '15'
condition:
  - condition: or
    conditions:
      - condition: time
        before: '21:00:00'
        after: '16:00'
      - condition: device
        device_id: 57381ed3c1aa08f002614706bff4321a
        domain: device_tracker
        entity_id: device_tracker.lg_webos_tv
        type: is_home
  - condition: sun
    after: sunset
    after_offset: '-2:00'
action:
  - condition: numeric_state
    entity_id: sun.sun
    attribute: elevation
    above: '-6'
  - type: turn_on
    device_id: da1cfb51c4579908b43f839764754738
    entity_id: light.woonkamer
    domain: light
    brightness_pct: 1
  - type: turn_on
    device_id: 482c7a7b85328942d535def8071a65f0
    entity_id: light.keuken
    domain: light
    brightness_pct: 1
  - delay: '00:00:05'
  - choose:
      - conditions:
          - condition: sun
            before: sunset
        sequence:
          - service: scene.turn_on
            data_template:
              entity_id: scene.zitten_woonkamer
              transition: >-
                {{ ( as_timestamp(states.sun.sun.attributes.next_setting) + (
                as_timestamp(states.sun.sun.attributes.next_dusk) -
                as_timestamp(states.sun.sun.attributes.next_setting) )/3 ) -
                as_timestamp(now()) }}
          - delay: >-
              {{ ( as_timestamp(states.sun.sun.attributes.next_setting) + (
              as_timestamp(states.sun.sun.attributes.next_dusk) -
              as_timestamp(states.sun.sun.attributes.next_setting) )/3 ) -
              as_timestamp(now()) }}
      - conditions:
          - condition: sun
            after: sunset
        sequence:
          - service: scene.turn_on
            data_template:
              entity_id: scene.zitten_woonkamer
              transition: >-
                {{ ( as_timestamp(states.sun.sun.attributes.next_setting)-86400
                + ( as_timestamp(states.sun.sun.attributes.next_dusk) -
                (as_timestamp(states.sun.sun.attributes.next_setting)-86400) )/3
                ) - as_timestamp(now()) }}
          - delay: |-
              {{ ( as_timestamp(states.sun.sun.attributes.next_setting)-86400 +
                ( as_timestamp(states.sun.sun.attributes.next_dusk) -
                (as_timestamp(states.sun.sun.attributes.next_setting)-86400) )/3 ) -
                as_timestamp(now()) }}
    default: []
  - scene: scene.zitten_woonkamer
  - type: turn_on
    device_id: f1ed77bc860c822dfe4469d630a4daf8
    entity_id: light.gang_bg
    domain: light
    brightness_pct: 10
mode: single

Weird. The only thing I notice about your automation is semantic, and should not have caused the issue:

Why is this condition in the action block?

If it applies to all actions (as it does) shift it up into the condition block.

  - condition: numeric_state
    entity_id: sun.sun
    attribute: elevation
    above: '-6'

Thanks Tom,
I’m sure I had my reasons at some point, but can’t really pinpoint any now, so I’ll move it into the condition block indeed.
Weird that the automation got triggered this morning then.

Could you tell at what time the automation was triggered?

The automation was triggered @ July 14, 2021, 6:25 AM

I’m wondering if that upset the trace. I opened an issue for script traces with a condiditon as the first action in the sequence.