Motion Sensor Continual detection results in lights off

You shouldn’t need a timer. If you have a “turn on” automation and a “turn off” automation…

triggers:
  - trigger: state
    entity_id:
      - binary_sensor.motion_sensor_motion
    to: "off"
    for:
      hours: 0
      minutes: 5
      seconds: 0

…in the “turn off” automation will only trigger if there is no motion for five minutes continuously.

Once you’ve got it working you can look at ways of combining on and off into one automation. There is an example here:

Motion activated lights automation