Motion activated light wait time automation

Try this:

alias: "Lights: Bathroom Automation"
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.p1_motion_ias_zone
    to: "on"
condition:
  - condition: time
    before: "07:00:00"
    after: "17:00:00"
    weekday:
      - sat
      - fri
      - thu
      - wed
      - tue
      - mon
      - sun
action:
  - service: light.turn_on
    data: {}
    target:
      entity_id: light.bathroom
  - wait_for_trigger:
      - platform: state
        entity_id:
          - binary_sensor.p1_motion_ias_zone
        to: "off"
  - delay:
      hours: 0
      minutes: 1
      seconds: 30
      milliseconds: 0
  - service: light.turn_off
    data: {}
    target:
      entity_id: light.bathroom
mode: restart

By the way, you will find lots of blueprints already tested to do exactly what you want… :wink:
This one from @Blacky is probably a good option for you: 💡 Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time