Light Sensor using VEML7700

Using an ESP32 and Adafruit VEML7700 to measure UV light levels – UV index values and Lux levels:

Adafruit VEML7700 Ambient Light Sensor

esphome:
  name: light
  friendly_name: light
  includes:
  - /config/veml7700.h

  libraries:
    - "Wire"
    - "Adafruit Unified Sensor"
    - "SPI"
    - "Adafruit BusIO"
    - "Adafruit VEML7700 Library"

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "5ahEglhdocQ2xU2wzJpOtMAar6ihhna9Xh7cJrHrGBU="

ota:
  password: "e77cc6a990001b6813a6705822241c8c"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Light Fallback Hotspot"
    password: "HsLOrYzCA2Pz"

captive_portal:

i2c:
  sda: 21
  scl: 22
  scan: true
  id: bus_a

sensor:
  - platform: custom
    lambda: |-
      auto my_veml7700_sensor = new MyVEML7700Sensor();
      App.register_component(my_veml7700_sensor);
      return {
        my_veml7700_sensor->veml7700_lux
          // , my_veml7700_sensor->veml7700_white
          // , my_veml7700_sensor->veml7700_raw_als
          // , my_veml7700_sensor->veml7700_gain
          // , my_veml7700_sensor->veml7700_it
          // , my_veml7700_sensor->veml7700_interrupt_status
      };
    sensors:
    - name: "VEML7700 Lux"
      # filters:
      #   - median:
      #       # window_size: 5
      #       send_every: 1
      #       # send_first_at: 2
         # - exponential_moving_average:
         #     # window_size: 5
         #     send_every: 3
         #     # send_first_at: 5
      accuracy_decimals: 1
      unit_of_measurement: lux
        # poll_frequency: see veml7700.h, VEML_POLL_RATE
      # - name: "${node_name} VEML7700 White"
      #   accuracy_decimals: 1
      #   unit_of_measurement: lux
      # - name: "${node_name} VEML7700 raw ALS"
      #   accuracy_decimals: 1
      #   unit_of_measurement: raw

  - platform: ltr390
    uv_index:
      name: "UV Index"
      filters:
      - multiply: 95
    uv:
      name: "UV Level"
    light:
      name: "Light"
    gain: "X1"
    resolution: 18
    window_correction_factor: 1.0
    update_interval: 5s