I have an ESP32-CAM unit I wanted to try to connect to Home Assistant. This is how I managed to add it.

First I Googled and found the esp32_camera component for ESPHome so it was a natural start since I already have several other ESPHome devices.

After a while I found that the esp32_camera component came with a number of configuration examples. After a little investigation among checking the https://github.com/raphaelbs/esp32-cam-ai-thinker project I realized that I should be able to use the Ai-Thinker Camera-example.

I also wanted to be able to control the LEDs on the board, both the status LED and the Flash and added those as well.

This was my final yaml configuration which I added to the rest of the ESP yaml in the ESP Builder

esp32_camera:
  name: 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
  resolution: 1600x1200 # Native resolutions CIF 400x296, SVGA 800x600, UXGA 1600x1200
  jpeg_quality: 10
  vertical_flip: false
  horizontal_mirror: false

output:
  - platform: gpio
    id: camera_flash_led
    pin: GPIO04

light:
  - platform: status_led
    name: "Camera status LED"
    pin: 
      number: GPIO33
      inverted: true

  - platform: binary
    name: "Camera Flash LED"
    output: camera_flash_led