esphome:
  name: sensori-soggiorno
  friendly_name: Sensori Soggiorno

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxxxxxxxxxxxx"

ota:
  - platform: esphome
    password: "xxxxxxxxxxxxxxxx"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Sensori-Soggiorno"
    password: "JBO3b6Ct3BH6"

captive_portal:

i2c:
  sda: 21
  scl: 22

button:
  - platform: restart
    name: "Riavvio ESP32 soggiorno"

sensor:
  - platform: dht
    pin: 18
    temperature:
      name: "Temperatura Soggiorno"
    humidity:
      name: "Umidità Soggiorno"
    update_interval: 15s

  - platform: adc
    pin: 33
    name: "Luminosità"
    id: lightin
    update_interval: 5s
    attenuation: auto
    unit_of_measurement: "%"
    icon: "mdi:brightness-5"
    filters:
     - calibrate_linear:
       - 2.40000 -> 100
       - 0.07500 -> 0

switch:
  - platform: gpio
    pin: 14
    name: "LED 2"
    icon: "mdi:led-on"  
  - platform: gpio
    pin: 27
    name: "LED 1"
    icon: "mdi:led-on"
  - platform: gpio
    pin: 13
    name: "Pin Test"
    icon: "mdi:test-tube"
 
   
