Sensor-controlled switch too 'bouncy' - need help eliminating extra triggering

Greetings - looking for some configuration/automation help. I have a motion sensor that triggers a light switch. I want the switch to turn off after 10 minutes of inactivity, BUT when the lights turn off, it triggers the motion detector to fire and then the lights turn back on!

Is there a way to make it ignore the sensor for 5 seconds after the lights turn off?

- action:
  - data:
      brightness: '80'
      entity_id: light.basement_31
    service: light.turn_on
  alias: Basement On with Movement
  condition: []
  id: '1508620476415'
  trigger:
  - entity_id: binary_sensor.vistacam_700_motion_sensor_18
    from: 'off'
    platform: state
    to: 'on'
- action:
  - data:
      entity_id: light.basement_31
    service: light.turn_off
  alias: Basement Light Off After 10 Minutes
  condition: []
  id: '1508624466805'
  trigger:
  - entity_id: binary_sensor.vistacam_700_motion_sensor_18
    from: 'on'
    platform: state
    to: 'off'
    for:
      minutes: 2

I found a solution: add a condition that requires the switch to be off for at least 5 seconds. Pretty obvious, sad that it took me so long to come across it.

- action:
  - data:
      brightness: '80'
      entity_id: light.basement_31
    service: light.turn_on
  alias: Basement On with Movement
  condition:
  - condition: state
    entity_id: light.basement_31
    state: 'off'
    for:
      seconds: 5
  id: '1508620476415'
  trigger:
  - entity_id: binary_sensor.vistacam_700_motion_sensor_18
    from: 'off'
    platform: state
    to: 'on'