esphome:
  name: espgaz
  platform: ESP32
  board: esp-wrover-kit
   
  on_boot:
    priority: 200
    then:
    - light.turn_on:
        id:  cam_light
        brightness: 65%
    # - mqtt.publish:
        # topic: espgaz/last_update
        # payload: "Something happened!"

# deep_sleep:
  # run_duration: 50sec
  # sleep_duration: 550sec

logger:

api:
  encryption:
    key: !secret api_encryption_key

ota:
  password: !secret ota_key

wifi:
  ssid: "lauIOT"
  password: "superiot1"
  domain: .home.cabestan.be

  ap:
    ssid: "Espgaz Fallback Hotspot"
    password: !secret ap_secret

captive_portal:

web_server:
  port: 80

time:
  - platform: sntp
    id: esptime
    timezone: "Europe/Brussels"
    on_time:
      - seconds: /30
        then:
          - light.turn_on:
              id:  cam_light
              brightness: 65%
          - delay: 1s
          - mqtt.publish:
              topic: espgaz/last_update
              payload: !lambda |-
                char out[32];
                sprintf(out,"%f",id(my_uptime).state);
                return out;
          - delay: 5s
          - light.turn_off:
              id:  cam_light

mqtt:
  broker: 192.168.30.10
  username: espgaz
  password: "65eg64e8r7g98"
  id: esp_mqtt

sensor:
  - platform: uptime
    name: Uptime Sensor
    id: my_uptime
 
esp32_camera:
  name: cam_gas_counter
  ae_level: 1
  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
  jpeg_quality: 10
  special_effect: grayscale
  max_framerate: 2fps
  resolution: 1600x1200 
  idle_framerate: 0.1fps

esp32_camera_web_server:
  - port: 8080
    mode: snapshot

output:
  - platform: ledc
    pin: GPIO4
    id: gpio_4
    channel: 2

## GPIO_4 is the flash light pin
light:
  - platform: monochromatic
    output: gpio_4
    name: PWM light
    id: cam_light
