Turn on the light based on motion-sensor error "Message malformed: extra keys not allowed @ data['trigger']"

I’ve been trying for a while to create an automation for turning a smart bulb (Tapo) on/off based on motion detected by a sensor (Ikea Zigbee motion sensor).

What do I want to achieve? I want to turn on the light (in the bathroom) between 7 PM and 12 AM at a brightness of 70%, and between 12 AM and 7 AM at a brightness of 10%, when the motion sensor detects presence. After detecting motion, the light should turn on for 2 minutes and then turn off.

I tried the following script, but i cant save it because it gave me the error " Message malformed: extra keys not allowed @ data[‘trigger’] "

description: "Turn on the light on motion, turn off after no motion for 2 minutes."
mode: restart
trigger:
  - platform: state
    entity_id:
      - binary_sensor.ikea_motion_sensor_occupancy
    from: "off"
    to: "on"
    id: "on_motion"
  - platform: state
    entity_id:
      - binary_sensor.ikea_motion_sensor_occupancy
    from: "on"
    to: "off"
    for:
      hours: 0
      minutes: 2
      seconds: 0
condition: []
action:
  - if:
      - condition: trigger
        id:
          - "on_motion"
    then:
      - choose:
          - conditions:
              - condition: time
                after: "00:00:00"
                before: "07:00:01"
            sequence:
              - action: light.turn_on
                data:
                  brightness_pct: 10
                target:
                  entity_id: light.bathroom
          - conditions:
              - condition: time
                before: "00:00:00"
                after: "19:00:00"
            sequence:
              - action: light.turn_on
                data:
                  brightness_pct: 70
                target:
                  entity_id: light.bathroom
    else:
      - action: light.turn_off
        data: {}
        target:
          entity_id: light.bathroom

I’m using HA core 2024.8.2 running as a container in docker ( Portainer ).

Start with simple automation to better understand the sequence then duplicate it for the other time frame

alias: 7PM to Midnight
description: ""
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.xxxx
    from: "off"
conditions:
  - condition: time
    after: "19:00:00"
    before: "23:59:00"
actions:
  - type: turn_on
    device_id: 1f2327487aea01811f3e2ae9f6df6e14
    entity_id: 0c2486df5bdde1fca4ef6fa960906a1b
    domain: light
    brightness_pct: 70
  - delay:
      hours: 0
      minutes: 2
      seconds: 0
  - type: turn_off
    device_id: 1f2327487aea01811f3e2ae9f6df6e14
    entity_id: 0c2486df5bdde1fca4ef6fa960906a1b
    domain: light
mode: single

gives me the same error " Message malformed: extra keys not allowed @ data[‘triggers’] "

Can you post your new code?

When using the UI, it should look something like this…