Help with Complex Motion Sensor Automation

The trigger will ALWAYS either be the first or second trigger because the ID is just how you refer to the trigger. Your time checks need to be in the choose blocks, in order to decide what scene is activated.

You should only have ONE trigger for this, because both triggers are pointing to the same device.

alias: Turn On Kitchen Lights on Motion
description: ''
trigger:
  - type: motion
    platform: device
    device_id: 5ebd7d8857ed491b7ba83e91f740c20c
    entity_id: binary_sensor.motion_sensor_1_ias_zone
    domain: binary_sensor
    id: motion
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: motion
        sequence:
          - choose:
              - conditions:
                  - condition: time
                    after: '15:59'
                    before: '22:00'
                sequence:
                  - scene: scene.kitchen_ceiling_lights_warm
              - conditions:
                  - condition: time
                    before: '08:00'
                sequence:
                  - scene: scene.kitchen_ceiling_middle
            default: []
          - service: timer.cancel
            target:
              entity_id: timer.kitchen_motion_timer
          - service: timer.start
            data:
              duration: '0'
            target:
              entity_id: timer.kitchen_motion_timer
    default: []
mode: restart

How does this work?