Weather & ScienceTechnician

UV Index Monitor with ESPHome

Measure the real UV index in your yard and get a Home Assistant alert before the sun gets dangerous.

LevelTechnician
Time1 h
Est. cost~$20
Steps5

The LTR390 sensor measures ultraviolet light directly and ESPHome converts it to a UV index. In sunny places the UV index can climb high before noon — a live number on your phone helps you plan sunscreen, shade and outdoor work.

⚠ SAFETY
This is a hobby sensor, not a certified instrument. Follow official UV forecasts and health guidance for sun protection.

Mission steps

  1. Wire the sensor

    LTR390 VIN to 3V3, GND to GND, SDA to GPIO8 and SCL to GPIO9 on the ESP32-S3.

  2. Flash ESPHome

    Create a new device in the ESPHome Builder add-on, paste the YAML and install it over USB the first time.

  3. Mount it outdoors

    Point it at the open sky inside a weatherproof box. Ordinary glass and most plastics block UV, so the sensor window must stay uncovered or use a UV-transparent cover.

  4. Compare readings

    Check your value against the official forecast UV index on a clear day; adjust the window correction if you use a cover.

  5. Automate alerts

    In Home Assistant, send a phone notification when the UV index goes above 6.

Code

esphome:
  name: uv-monitor

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf

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

logger:
api:
ota:
  - platform: esphome

i2c:
  sda: GPIO8
  scl: GPIO9

sensor:
  - platform: ltr390
    uv_index:
      name: "UV Index"
    light:
      name: "Outdoor Light"
    update_interval: 60s

Tip: test every script on the bench before installing it in a moving machine.

Questions

Can I put it behind a window?

No. Window glass blocks most UV-B, so the reading would be far too low. It must see the sky directly.