Need help with automation code

This code is failing. I want to have the hallway lights turn off if
left on for more than 8 minutes
Between the hours of 06:31 until the next day morning at 06:14
Either person must be present

Error:

Invalid config for [automation]: [entity_id] is an invalid option for [automation]. Check: automation->condition->0->conditions->1->conditions->1->entity_id. (See /config/configuration.yaml, line 8). 

Here is the the code in question:

- alias: 'turn hallway lights off'
  trigger:
    platform: state
    entity_id: light.hallway
    to: 'on'
    for:
      hours: 0
      minutes: 8
  condition:
      condition: and
      conditions:
        - condition: time
          after: '06:31:00'
          before: '06:14:00'
        - condition: or
          conditions:
            - condition: state
              entity_id: input_boolean.duc_home
              state: 'on'
            - condition: time
              entity_id: input_boolean.eri_home
              state: 'on'
  action:
    service: light.turn_off
    entity_id: light.hallway

Your last condition should be state not time.

Good eyes! Thank you.

i never knew that it’s possible to combining conditions that way. Interesting new possibilities for me :slight_smile:
btw. there is some wrong indentation in condition: too, i think should be:

  condition:
    condition: and
    conditions:
      - condition: time
        after: '06:31:00'
        before: '06:14:00'
      - condition: or
        conditions:
          - condition: state
            entity_id: input_boolean.duc_home
            state: 'on'
          - condition: state
            entity_id: input_boolean.eri_home
            state: 'on'

i just found Combining 'AND' and 'OR' conditions and it should also be possible or better to write:

  condition:
    - condition: time
      after: '06:31:00'
      before: '06:14:00'
    - condition: or
      conditions:
        - condition: state
          entity_id: input_boolean.duc_home
          state: 'on'
        - condition: state
          entity_id: input_boolean.eri_home
          state: 'on'