https://www.theengineeringprojects.com/ ... ensor.html
It shows how to detect motion with ESP32 using a PIR motion sensor. The code is based on an external interrupt function.
If it only happens outside a few possibilities spring to mind :
1. The ESP has upped it's transmission strength because the AP is further away
2. Other signals are in the area and interfering
3. It's draughty where the sensor is (wind can affect them as well)
You'll need to experiment to narrow the cause down