Open-source WLED usermod

Sensor Hub for WLED

One usermod turns sensor readings into MQTT, Home Assistant discovery and the JSON API. Consumer usermods read the same bus back into effects, brightness and color, live.

23Providers 2Consumers 1Hub WLEDBuilt for

How it fits together

One usermod owns the bus. Everything else either feeds it or reads from it. No provider ever talks to MQTT, JSON or HA directly, and no consumer ever needs to know which physical chip a reading came from.

Providers

Read one piece of hardware (an I2C chip, a GPIO pin, and so on) and push readings into the hub.

Sensor Hub

Owns MQTT/HA discovery, the JSON API and the Info tab, with sensors registering at compile time and attaching at runtime. No fixed limit.

Sensor Hub

Exposes readings by name (getValueByName()) or by quantity (getValue(type)).

Consumers

Read the hub and drive an effect, a color, or brightness, either through a bespoke effect or a generic live binding.

The Hub

sensor-hub

Compile-time sensor slot registration with no fixed sensor limit, an open string-identified measurement type system, MQTT and Home Assistant discovery, the JSON API, and Info tab display with per-quantity unit conversion.

View on GitHub

Sensor Providers

Each provider owns exactly one piece of hardware and knows nothing about MQTT, JSON or Home Assistant. That's the hub's job. Tick any you're using to add them to the config builder below.

Temperature & Humidity

BME280

Bosch BME280: temperature, humidity, pressure.

SHTC3

Sensirion SHTC3: temperature, humidity.

Si7021

Silicon Labs Si7021: temperature, humidity.

AHT10 / AHT20

Aosong AHT10/AHT20: temperature, humidity.

DHT11 / DHT22

DHT11 / DHT22 (AM2302): temperature, humidity.

DS18B20

Dallas/Maxim 1-Wire probe: temperature only.

Internal Temperature

The ESP32's own built-in die temperature sensor. No extra hardware.

Air Quality

SCD40 / SCD41

Sensirion SCD4x: true NDIR co2 (ppm), plus temperature/humidity.

BME68X

Bosch BME680/BME688: temperature, humidity, pressure, plus raw gas_resistance.

Light & Color

BH1750

Rohm BH1750: calibrated illuminance (lx).

LDR

Simple photoresistor voltage divider: uncalibrated 0-100% light level.

TCS34725

RGB color and ambient light: illuminance, color_temp, R/G/B channels.

Motion & Presence

PIR

HC-SR501 and similar: single binary motion sensor.

LD2410

Hi-Link mmWave presence radar: presence plus moving/stationary distance.

Distance & Ranging

VL53L0X

ST time-of-flight sensor: distance (mm), I2C.

HC-SR04

Ultrasonic distance: cheaper, longer-range alternative that also works outdoors.

Orientation & Motion (IMU)

QMI8658

6-axis IMU: 3-axis acceleration exposed.

MPU-6050

InvenSense 6-axis IMU: 3-axis acceleration exposed.

Electrical

ADS1115

TI 16-bit 4-channel ADC: four generic analog voltage inputs.

INA226

Current/voltage/power monitor: voltage, current, power.

MAX17048

LiPo/LiIon fuel gauge: voltage, battery (%).

Soil & Environment

Soil Moisture

Capacitive probe: calibrated 0-100% moisture level.

Generic I/O

GPIO Contact

4 independent digital pins: reed switches, float switches, dry contacts.

Consumer Usermods

These don't provide sensors. They read the hub and drive WLED itself. Tick any you're using to add them to the config builder below.

particle-tilt-effect

Adds a new WLED effect, “Accel Tilt”: a particle-system box that tilts with a real accelerometer reading, instead of a canned animation.

sensor-fx-binder

Binds live sensor readings to any existing effect's speed/intensity/custom sliders, brightness, color or checkboxes, generically, with no bespoke effect required.

Build your config

Tick whatever you're using above (or use the buttons below), then copy the generated custom_usermods block straight into your platformio_override.ini. Links point at each usermod's published repo, so PlatformIO fetches everything automatically. No local cloning required.

custom_usermods =
  ${env:esp32dev.custom_usermods}
  # tick sensors and consumers above to build your config

Getting started

  1. Tick your hardware and any consumer usermods above, then copy the generated config from Build your config.
  2. Paste it into platformio_override.ini, in the environment you build:
[env:esp32dev]
extends = env:esp32dev
custom_usermods =
  ${env:esp32dev.custom_usermods}
  https://github.com/lost-hope/sensor-hub.git
  https://github.com/lost-hope/sensor-hub-bme280-provider.git
  1. Build and flash. Configure each provider's pins/I2C in its own Settings page. Sensors appear in MQTT, the Info tab and /json/state automatically once attached.

Full wiring, settings and MQTT/HA discovery details are documented in each repo's own readme. Start with sensor-hub.