Looking for a door sensor that will activate a flow upon opening and then closing door?

What if u use a timer?
Door open> start timer

Door closed > and timer is less then 10sec

Door closed flow
Else do nothing