substitutions:
  devicename: esp-cam01
  Device_Location: ESP CAM 01
  update_interval: !secret d1-update_interval
  ipaddress: 10.0.0.40

esphome:
  name: "esp-cam-01"
  friendly_name: "ESP-CAM-01 Study Camera"      

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
  level: WARN

# Enable Home Assistant API
api:
  encryption:
    key: !secret mogwai_api_key

ota:
  platform: esphome
  password: !secret mogwai_ota_key

wifi:
  ssid: !secret mogwai_wifi_name
  password: !secret mogwai_wifi_password
  <<: !include common/network.yaml
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "esp-cam-01 Fallback Hotspot"
    password: "KYcEKo8Kf2vd"

captive_portal:

switch:

  - platform: gpio
    id: led_flash
    name: "onboard_flash"
    pin:
      number: GPIO04
      mode: OUTPUT
      inverted: false
    restore_mode: ALWAYS_OFF

  - platform: gpio
    id: led_onboard
    name: "$devicename Onboard LED"
    pin:
      number: GPIO14
      mode: OUTPUT
    restore_mode: ALWAYS_ON

#<<: !include common/mqtt-onb.yaml

#<<: !include common/time.yaml

<<: !include common/website.yaml

# Example configuration entry
esp32_camera:
  name: My 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

# Example configuration entry
esp32_camera_web_server:
  - port: 8080
    mode: stream
  - port: 8081
    mode: snapshot

<<: !include common/external-heapmon.yaml