Switch on if the door is closed at least for 2 seconds

We have a door with a door sensor and a light in the room. Also have a presence sensor. There is an automation which automates the light based on different situations:

  • On when the door is opened
  • Keeps on while we are in the room
  • Off when there is no presence
    We also can switch off the light with a physical zigbee switch.
    The problem that some of my family mates are not closing the door but just pushes. so it starts to close but opens a little bit immediately.
    I use trigger IDs and “Choose” in my automation and I’d like to add a condition to turn on the light if when the door is opened but only when the door was closed for at least 2 seconds before.
    How could I do it?
    Entities:
  • binary_sensor.door_contact
  • light.room