Esp32 cam + PIR motion - not show real PIR status

Hi
Basically the camera works great. the PIR turn on and I see it in the HA
The problem - the PIR did not show the real status
for example - its turn OFF and immediately turn ON (not have any motion near the PIR)
This pattern happens every 15-30s
I check the PIR on d1 mini pro and it work great.
I want to be connected to esp32 cam
What wrong with the code ?

11:58:18][D][esp32_camera:157]: Got Image: len=13427
[11:58:25][D][esp32_camera:157]: Got Image: len=13509
[11:58:33][D][binary_sensor:036]: 'PIR Sensor456': Sending state OFF
[11:58:34][D][binary_sensor:036]: 'PIR Sensor456': Sending state ON
[11:58:35][D][esp32_camera:157]: Got Image: len=13413
[11:58:45][D][esp32_camera:157]: Got Image: len=13528
[11:58:52][D][binary_sensor:036]: 'PIR Sensor456': Sending state OFF
[11:58:54][D][binary_sensor:036]: 'PIR Sensor456': Sending state ON
[11:58:55][D][esp32_camera:157]: Got Image: len=13351
[11:59:05][D][esp32_camera:157]: Got Image: len=13443
substitutions:
  # Modify variables based on your settings
  hostname: 'testcam'
  ssid: '****'
  password: '****'
  
esphome:
  name: $hostname
  platform: ESP32
  board: esp32dev
wifi:
  ssid: $ssid
  password: $password
  fast_connect: true
  reboot_timeout: 45min
  manual_ip:
    static_ip: 192.168.1.70
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: *****
    dns2: *****
api:
  reboot_timeout: 0s
ota:
logger:

# ESP32-CAM
esp32_camera:
  external_clock:
    pin: GPIO0
    frequency: 20MHz
  i2c_pins:
    sda: GPIO26
    scl: GPIO27
  data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
  vsync_pin: GPIO25
  href_pin: GPIO23
  pixel_clock_pin: GPIO22
  power_down_pin: GPIO32

  name: testcam
  
binary_sensor:
  - platform: gpio
    pin: GPIO12
    name: "PIR Sensor456"
    device_class: motion

Someone please help (:

Eliminate things thast could be interfering. Comment out all the camera stuff and run JUST the PIR. Does it still do strange stuff?

Yes
I try it.

Something triggers the PIR. I really don’t know what maybe some inside clock

How is your PIR wired?

What exactly is it?

Does this help? https://forum.sparkfun.com/viewtopic.php?t=40357

Could you also paste the specs of your transistor/mosfet and PIR used?

I’m following this tut https://randomnerdtutorials.com/esp32-cam-pir-motion-detector-photo-capture/ though I’ve replaced the 2N3904 transistor with a 2N2222.