Expire Motion Sensor -> Run other script/switch off other items

Hey!

I would like to run a script if my motion sensor or window sensor doesn’t not detect any movement during the last 5 minutes after the last movement detection.

For example: If I open my front door, I want to run a script to inform me, that the door is open for more than 5 minutes.

Or: If the motion sensor detects no motion for 15 minutes I want to turn of all lights in one room and power off my devices.

I use hue motion sensors, aqara door sensors and shellys. Is there a very easy solution for this?

Thanks!

Lars

See Open Reminder [3.3.0;3.4.0) and [Deprecated] Design Pattern: Motion Sensor Timer