esphome:
  name: ethelhome

esp32:
  board: esp32dev
  framework:
    type: esp-idf

esp32_ble_tracker:  # Enables BLE tracking
bluetooth_proxy:    # Enables Bluetooth proxy for Home Assistant
captive_portal:
web_server:
  port: 80
  auth:
    username: "b"
    password: "8"
  css_url: "https://files.bobbyw.name/esphome.css"
  include_internal: true

ota:
  password: "iliketurtles"
  platform: esphome

wifi:
  ssid: "Good Job Bob's Orphanage"
  password: "iliketurtles"
  ap:
    ssid: "Ethel Hotspot"
    password: "iliketurtles"

api:
  encryption:
    key: "sUPvOWVhYSPM4ze1hwCm7kqvY9rSvDmKcPA3f0pCDy0="

uart:
  - id: rs485
    tx_pin: GPIO27
    rx_pin: GPIO14
    baud_rate: 9600
  - id: rs232
    tx_pin: GPIO17
    rx_pin: GPIO16
    baud_rate: 9600

spi:
  clk_pin: GPIO18
  mosi_pin: GPIO23
  miso_pin: GPIO19
  # cs pin: GPIO5

i2c:
  sda: GPIO4
  scl:
    number: GPIO15
    ignore_strapping_warning: true

pcf8574:
  - id: inputs
    address: 0x22
  - id: outputs
    address: 0x24

time:
  - platform: ds1307
    id: rtc_time

binary_sensor:
  - platform: gpio
    name: "Lights Driver Side"
    pin:
      pcf8574: inputs
      number: 0
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "Lights Passenger Side"
    pin:
      pcf8574: inputs
      number: 1
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "LED Light Bar"
    pin:
      pcf8574: inputs
      number: 2
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "Seat Heater Driver Side"
    pin:
      pcf8574: inputs
      number: 3
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "Seat Heater Passenger Side"
    pin:
      pcf8574: inputs
      number: 4
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "Refrigerator"
    pin:
      pcf8574: inputs
      number: 5
      mode: INPUT
      inverted: true

switch:
  - platform: gpio
    name: "Lights Left"
    id: relay_1
    pin:
      pcf8574: outputs
      number: 0
      mode: OUTPUT
      inverted: true
  - platform: gpio
    name: "Lights Right"
    id: relay_2
    pin:
      pcf8574: outputs
      number: 1
      mode: OUTPUT
      inverted: true
  - platform: gpio
    name: "LED Light Bar"
    id: relay_3
    pin:
      pcf8574: outputs
      number: 2
      mode: OUTPUT
      inverted: true
  - platform: gpio
    name: "Seat Heater Driver Side"
    id: relay_4
    pin:
      pcf8574: outputs
      number: 3
      mode: OUTPUT
      inverted: true
  - platform: gpio
    name: "Seat Heater Passenger Side"
    id: relay_5
    pin:
      pcf8574: outputs
      number: 4
      mode: OUTPUT
      inverted: true
  - platform: gpio
    name: "Refrigerator"
    id: relay_6
    pin:
      pcf8574: outputs
      number: 5
      mode: OUTPUT
      inverted: true
sensor:
  - platform: adc
    pin: GPIO34            # or whichever ADC pin you're using
    name: "Van Starter Battery Voltage"
    attenuation: 12db
    update_interval: 30s
    filters:
      - multiply: 5.7

  - platform: adc
    pin: GPIO33            # or whichever ADC pin you're using
    name: "Van Leisure Battery Voltage"
    attenuation: 11db
    update_interval: 30s
    filters:
      - multiply: 5.7       
 
  - platform: dht
    pin: GPIO12
    model: DHT22
    temperature:
      name: "Van Temperature"
      id: van_temp
    humidity:
      name: "Van Humidity"
      id: van_humidity
    update_interval: 120s
    
  - platform: dht
    pin: GPIO13
    model: DHT22
    temperature:
      name: "Refrigerator Temperature"
      id: refrigerator_temp
    humidity:
      name: "Refrigerator Humidity"
      id: refrigerator_humitity
    update_interval: 120s