esphome:
  name: pet-feeder

  on_boot:
    priority: 100
    then:
      - light.turn_off: bowl_light

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "your password"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Pet-Feeder Fallback Hotspot"
    password: "your ap password"

captive_portal:

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: "Bowl Camera"

output:
  - platform: ledc
    pin: GPIO4
    id: led_output
    channel: 2
    frequency: 500Hz

  - platform: ledc
    id: pwm_output
    pin: GPIO12
    frequency: 50 Hz

light:
  - platform: monochromatic
    output: led_output
    name: "Bowl Camera LED"
    id: bowl_light

    on_turn_on:
      then:
        - delay: 15s
        - output.turn_off: led_output

servo:
  - id: feed_servo
    output: pwm_output

button:
  - platform: template
    name: "Feeding Button"
    on_press:
        - light.turn_on: 
            id: bowl_light
        - servo.write:
            id: feed_servo
            level: -40%
        - delay: 0.4s
        - servo.detach: feed_servo
        - delay: 0.2s
        - servo.write:
            id: feed_servo
            level: 30%
        - delay: 2s
        - servo.detach: feed_servo
        - delay: 0.2s

