The main reason for this issue is the sensor detecting unwanted motions. All you need is to lower the sensitivity levels of the sensor. For instance, block the lens part of the sensor while using a PIR sensor. Also, ensure that the motion sensor won’t get distracted from outside noises, and if possible, reposition the sensor to confirm that they detect inside the room only but not outside.