Spectrum Card

Hi everyone! :wave:

I’m excited to share a new custom Lovelace card I’ve been working on for visualizing AS7341 spectral sensor data in Home Assistant. This is perfect for anyone monitoring grow lights, analyzing light quality, or optimizing plant growth conditions.

What is it?

The AS7341 Spectrum Card displays real-time spectral data from the AMS AS7341 11-channel spectral sensor in a beautiful, interactive visualization. It shows the complete light spectrum from UV to Near-IR with smooth rainbow gradients.

:sparkles: Key Features

  • :rainbow: Beautiful spectrum visualization - Smooth rainbow gradient showing your light’s spectral distribution
  • :bar_chart: Interactive tooltips - Hover over the spectrum to see exact values at any wavelength
  • :dart: 8 spectral channels - Displays all AS7341 channels (415nm - 680nm)
  • :bulb: Clear & NIR support - Shows Clear and Near-Infrared readings
  • :warning: Smart calibration warnings - Automatically detects sensor saturation or weak signals
  • :art: Modern design - Sleek, gradient-based UI that fits perfectly with Home Assistant
  • :iphone: Fully responsive - Works great on desktop, tablet, and mobile

How It Works

The card reads data from your ESPHome-configured AS7341 sensor and creates a smooth, interpolated spectrum curve. When you hover over the chart, you can see exact values at any wavelength. The card even automatically detects if your sensor is saturated or needs calibration adjustments!

Installation

Via HACS (Recommended)

  1. Open HACS → Frontend
  2. Click ⋮ menu → Custom repositories
  3. Add: https://github.com/goatboynz/HA-par-spectrum-card
  4. Category: Lovelace
  5. Install and restart Home Assistant

Manual Installation

  1. Download as7341-spectrum-card.js from the GitHub repo
  2. Copy to config/www/
  3. Add as a Lovelace resource
  4. Restart Home Assistant

Configuration

ESPHome Setup

First, configure your AS7341 sensor in ESPHome:

sensor:
  - platform: as7341
    atime: 29        # Integration time
    astep: 599       # Integration steps
    gain: X8         # Start with lower gain
    update_interval: 5s
    
    f1:
      name: "Spectrum 415nm Violet"
    f2:
      name: "Spectrum 445nm Blue"
    f3:
      name: "Spectrum 480nm Cyan"
    f4:
      name: "Spectrum 515nm Green"
    f5:
      name: "Spectrum 555nm Yellow-Green"
    f6:
      name: "Spectrum 590nm Yellow"
    f7:
      name: "Spectrum 630nm Orange"
    f8:
      name: "Spectrum 680nm Red"
    clear:
      name: "Spectrum Clear"
    nir:
      name: "Spectrum NIR"

Lovelace Card

Add to your dashboard:

type: custom:as7341-spectrum-card
title: Light Spectrum Analysis
entities:
  f1: sensor.spectrum_415nm_violet
  f2: sensor.spectrum_445nm_blue
  f3: sensor.spectrum_480nm_cyan
  f4: sensor.spectrum_515nm_green
  f5: sensor.spectrum_555nm_yellow_green
  f6: sensor.spectrum_590nm_yellow
  f7: sensor.spectrum_630nm_orange
  f8: sensor.spectrum_680nm_red
  clear: sensor.spectrum_clear      # Optional
  nir: sensor.spectrum_nir          # Optional

Use Cases

This card is perfect for:

  • :seedling: Grow light monitoring - Ensure your plants get the right spectrum
  • :microscope: Light quality analysis - Compare different light sources
  • :sun_with_face: Natural light tracking - Monitor sunlight spectrum throughout the day
  • :bulb: LED testing - Analyze LED bulb spectral output
  • :art: Color temperature monitoring - Visualize light color characteristics

Technical Details

The AS7341 sensor measures light at 8 specific wavelengths:

  • F1 (415nm) - Violet
  • F2 (445nm) - Blue
  • F3 (480nm) - Cyan
  • F4 (515nm) - Green
  • F5 (555nm) - Yellow-Green
  • F6 (590nm) - Yellow
  • F7 (630nm) - Orange
  • F8 (680nm) - Red

Plus Clear and Near-Infrared (NIR) channels for additional analysis.

The card uses cubic spline interpolation to create smooth curves between measurement points and automatically extends the spectrum to show natural drop-offs at the edges (380-750nm range).

Smart Features

Automatic Calibration Detection

The card monitors your sensor readings and alerts you if:

  • :warning: Sensors are saturated - All channels showing similar high values
  • :chart_with_downwards_trend: Signal is too weak - Values are too low for accurate readings
  • :bulb: No light detected - Sensor might be covered or in darkness

It even suggests which ESPHome parameters to adjust!

Interactive Tooltips

Hover anywhere on the spectrum to see:

  • Exact wavelength position
  • Interpolated intensity value
  • Specific channel data when near sensor points
  • Clear and NIR values in their respective regions

Links

Future Plans

I’m considering adding:

  • Historical spectrum comparison
  • Multiple sensor support on one card
  • Export spectrum data to CSV
  • PAR calculation display (optional)

Let me know if you have any suggestions or feature requests!

Credits

Built for the Home Assistant community with :heart:

Special thanks to:

  • AMS for the AS7341 sensor
  • ESPHome team for the integration
  • Home Assistant community for inspiration

Questions? Issues? Suggestions?

Feel free to ask here or open an issue on GitHub. I’m happy to help with setup or troubleshooting!

If you find this useful, please :star: star the repo on GitHub!

#custom-card lovelace ESPHome #grow-lights #spectrum sensor #visualization

4 Likes

You need to post on this thread where people are working on plant monitoring automation: New version of the plant integration
If you have the plans for the AS7341 to build out, it would make an amazing first ESPhome project for me!