Compile of on_time: keeps failing with "Unable to find action with the name 'seconds'."

So I admit to be new to ESPHome, but a veteran to Tasmota, Arduino, OpenWrt.

I am trying to use on_time trigger, but am failing to get it compiled.

Adding solar schedule worked, so the base yaml setup seems correct.
Now I am trying to also add some hard switch times, and the on_time keeps failing the compile.

I cannot figure it out. The on_time: sequence is straigt from the example.
What am I overlooking?

# Scheduled on/off
time:
  - platform: sntp
    id: sntp_time
    timezone: Europe/Amsterdam
    on_time:
      - seconds: 0
        minutes: 0
        hours: 6
        if:
          condition:
            - sun.is_below_horizon:
          then:
            - logger.log: Scheduled light on
            - light.turn_on: light_1
          else:
            - logger.log: Schedule ignored as it is after SunRise
      - hours: 22
        minutes: 0
        seconds: 0
        then:
          - logger.log: Scheduled light off
          - light.turn_off: light_1
Failed config

time.sntp: [source lamppaal-06.yaml:64]
  platform: sntp
  id: sntp_time
  timezone: Europe/Amsterdam
  on_time:  [source lamppaal-06.yaml:68]
    - [source lamppaal-06.yaml:68]
      
      Unable to find action with the name 'seconds'.
      seconds: 0 [source lamppaal-06.yaml:68]
      minutes: 0
      hours: 6
      if: 
        condition: 
          - sun.is_below_horizon: 

Your indentation might be wrong, try this:

time:
  - platform: sntp
    id: sntp_time
    timezone: Europe/Amsterdam
    on_time:
      - seconds: 0
        minutes: 0
        hours: 6
        then:
          - if:
              condition:
                - sun.is_below_horizon:
              then:
                - logger.log: Scheduled light on
                - light.turn_on: light_1
              else:
                - logger.log: Schedule ignored as it is after SunRise
      - hours: 22
        minutes: 0
        seconds: 0
        then:
          - logger.log: Scheduled light off
          - light.turn_off: light_1

edit: Also, welcome to the community :partying_face:

Yes, that was it. Thanks

So though the message was on the “hours” stanza, the actual problem was the indentation of the “if” action several lines later. Ok, will remember that.