With motion sensors that is usually desired behavior. When you are in a room and moving around, you don’t want the light to turn off until X minutes after the last motion detection.
Please don’t use Thread::sleep. And using a Thread::sleep in a while loop is just asking for trouble. Please see (OH 1.x and OH 2.x Rules DSL only] Why have my Rules stopped running? Why Thread::sleep is a bad idea.
I can absolutely see this Rule with the way the motion sensor works totally killing your Rules.
I know you found a solution but as a beginner, I want to warn you against this sort of coding practice in the future. It will cause problems.
And I always recommend, if you can implement something like this at the device, that is the best place to implement it.
I started to consider how to implement this in Rules but it isn’t all that straight forward and it isn’t clear what you are trying to accomplish by extending the motion timer to 5 minutes? Are you after the standard behavior most users are after where the motion sensor keeps a light on for 5 minutes after the last motion detection?
Or do you have some more unique requirement?
I ask because to achieve the 5 minutes after the last motion detection behavior it frankly doesn’t matter that the MotionSensor3 resets in 2 minutes. You want that Timer to get rescheduled every 2 minutes.