Stopping motion sensor from activating piston

Hi, I’ve made my first piston and so far it works well except I would like the sensor from resetting the piston. The sensor checks for motion every 5 seconds. When activated, the piston runs a light and dims and it turns off after 3 minutes. But if the sensor senses something again it’ll start the piston all over again. I’d like to keep the sensor from resetting the light within those 3 minutes and also not run if I activate the light myself

I think I got it by oversimplifying it. I just added a restriction to the piston at the end. I put to only run when the light is off