Neither of these are what you need. You need one of:
- Basic Profiles - Transformation Services | openHAB
- Debounce [4.0.0.0;4.9.9.9]
- Generic Presence Detection (which shows an application of the Debounce rule template)
- Design Pattern: Motion Sensor Timer (if you want to code it yourself
Assuming the debounce profile works for you there’s no rules required. The Debounce Rule Template you can install from Add-on Store → Automation in MainUI and then instantiate a rule based on the template.