I have seen people sharing false triggering on HC-SR501 when used with ESP8266. I will share the suggestions I have found.
"I noticed 2 sources of evil of the false positives.
1: Power supply interference, I tried 5 different usb adapters ranging from 500mA to 2A. I run now stable on a 500mA USB power from Ebay.
2: Rf interference. Wifi is 2,4 Ghz ( in my case) RF. I tried two different HC-SR501 and both were triggerd bij RF.
I tried also shielding. In my case it didn't help. My pir is only 5 cm away from the ESP.
I solved this with the next solutions:
A: Used a 47uF and 102pF power decompling consensator soldered over the pir power connections at the ESP8266 side.
B: Put the ESP in 802.11G mode instead of 802.11N mode. I think the Rf spectrum will be less in G mode.
C: Put the ESP in wifi STA mode only.
D: Lower the ESP wifi output power to 10dBm."
Thank, actually I added 2 capacitors and now it's working.