How do you build a smart lighting controller that keeps working reliably without the cloud, external servers, or hardcoded GPIO pins?

I just published a full 36-minute technical walkthrough taking Lumen—my open-source, self-hosted ESP32 smart lighting controller—completely apart: from the hardware and HAL board profiles down to the firmware architecture, CIE dimming curve, local automation engine, ESP-NOW multi-controller linking, and Home Assistant integration.

Overview: What Lumen Does

Lumen turns an ESP32 into a complete, self-contained lighting controller with its own web application served directly from flash. Lights, rooms, groups, scenes, interactive floor plans, and automations all run locally on the board with no user account and no internet connection required.

Everything demonstrated in the tutorial runs on real hardware—both a KinCony KC868-AP controller and a generic ESP32 DevKit.

What's Covered in the Tutorial

1. Hardware & Hardware Abstraction Layer (HAL)

  • PWM & I/O Expansion: How the ESP32 dims lights directly via PWM, and how the KinCony KC868-AP extends capabilities with a PCA9685 PWM driver, PCF8574 digital inputs, and relays.
  • Board Profiles: How the HAL and JSON board profiles decouple hardware definitions from firmware logic so no GPIO pin number is hardcoded.

2. Firmware Architecture & Lighting Engine

  • Concurrency & State Ownership: A clean embedded architecture built around a single lighting task that owns hardware outputs, fed by bounded command queues and an internal event bus.
  • From a Browser Tap to PWM: How a UI interaction translates into smooth 20 ms transitions, perceptually linear brightness via the CIE dimming curve, and the color/tunable-white mixing engine.

3. Boot Sequence, Flash Web App & Security

  • Persistent Storage & Boot: How configuration survives power cuts, how the boot sequence initializes safely, and how the web UI is served straight from flash.
  • Secure First Start: Enforced password setup on initial boot, PBKDF2 credential hashing, session management, and rate limiting.

4. Rooms, Scenes, Floor Plans & Local Automations

  • Rooms, Groups & Scenes: Organizing fixtures and smoothly fading between multi-light scenes.
  • Interactive SVG Floor Plans: Uploading custom floor plans to place live-glowing light controls—and why every uploaded SVG is validated twice for safety.
  • Local Automation Engine: Running time-based, sunrise/sunset, physical input, and rule-based automations locally with built-in loop protection.

5. Integrations, Multi-Controller ESP-NOW & Safe OTA

  • Home Assistant & Network Control: Two-way integration with Home Assistant via MQTT auto-discovery, alongside signed TCP and UDP control protocols.
  • Routerless Multi-Controller Linking (ESP-NOW): How multiple Lumen boards coordinate directly over ESP-NOW with device ownership rules, custom frame formatting, and replay protection.
  • Resilient OTA Updates: Self-verifying firmware updates with automatic rollback protection and backup/restore workflows.

Video Chapters

  • 0:00 Intro and welcome to Lumen
  • 1:50 The hardware
  • 4:24 Firmware architecture
  • 7:05 HAL, drivers and board profiles
  • 10:06 Storage, boot and the web app
  • 12:30 Flashing and the first start
  • 14:53 From a tap to PWM
  • 18:16 Rooms, groups and scenes
  • 20:16 Floor plans
  • 22:22 The automation engine
  • 25:00 MQTT and Home Assistant
  • 28:06 Multiple controllers: ESP-NOW
  • 31:02 Networking and security
  • 32:57 Updates, rollback and backups

Links & Source Code

If you're designing local-first ESP32 firmware, working with Home Assistant MQTT discovery, or building your own smart lighting hardware, feel free to explore the repository and share your feedback in the comments!