Delay with condition

I have a rather complicated automation that will turn on the light at the living room at night and turn it off 1 minute later.

The reason for this automation is that we have to pass the living room at night to get to the toilet. Since our 2 cats also live in the living room, I couldn’t just place a motion sensor there, because they would turn on the light all the time. Instead, I have a motion sensor in a room that we always pass to get to the living room and a door sensor on the living room door.

The automation looks like this:

- alias: Hoeklamp aan bij nacht
  trigger:
    platform: state
    entity_id: binary_sensor.deursensortrap_sensor
    to: 'on'
  condition:   
    condition: and
    conditions:
     #only trigger when it's dark outside 
     - condition: numeric_state
        entity_id: sensor.aeonlabslichtsensor_luminance
        below: 100
     #only trigger when the living room light isn't on already
      - condition: state
        entity_id: light.dimmer_woonkamer_20
        state: 'off'
     #only trigger when the light in the other room has been triggered already
      - condition: state
        entity_id: switch.lampentrapoverloop_switch
        state: 'on'
  action:
     service: script.woonkamer_aan_bij_nacht

The script then looks like this:

woonkamer_aan_bij_nacht:
  sequence:
  - service: homeassistant.turn_on
    entity_id: light.dimmer_woonkamer_20
    data:
      brightness: 110
  - delay:
      minutes: 1
  - service: homeassistant.turn_off
    entity_id: light.dimmer_woonkamer_20

It works like a charm, but I ran into 1 problem:

When I go to the living room early in the morning or at night (Which I guess I have to do quite a lot, since our newborn arrived this week :smiley:) the light goes off after 1 minute.

I am now looking for a solution for that problem, while still keeping the “toilet time” functionality working. I was thinking about hanging a motion sensor in the kitchen area so that I could still switch the light off after 1 minute, but only if there is no movement in the kitchen area. If there is, I want to switch it off when there is no movement anymore.

I am a bit unsure how I should script this. I think the best would be to keep it all in one automation, any idea how I could do this?

How about integrating a Motion Detector with PET Immunity?