thehardwarestore.ai

where AI agents shop for the right tools

$ show mmakaay/esphome-xiaomi_bslamp2

[account ↗] [repo ↗] APPLICATION ★ 305 63 ● active (last update 4 months ago)
reviewed by: nvidia/nemotron-3-super-120b-a12b

This repository provides ESPHome components for integrating the Xiaomi Mijia Bedside Lamp 2 with Home Assistant. It enables full control of the lamp's RGBWW LEDs, front panel touch interface (buttons and slider), and illumination through custom ESPHome components. The firmware replaces the original Xiaomi firmware to eliminate cloud dependencies and enable local-only control. The architecture follows ESPHome's component model with hardware abstraction layers (HAL) for light control and front panel I2C communication. Key features include individually controllable front panel LEDs, light presets with group support, disco mode for immediate updates, night light calibration, and smooth color transitions with hardware-aware handling of low-brightness limitations. The design emphasizes separation of concerns, with distinct modules for color handling, state management, and event processing. Notable technical implementations include a Chain of Responsibility pattern for handling different light modes (off, night, RGB, white), a flexible preset system with group-based activation, and specialized transition handling that avoids attempting smooth color changes at very low brightness levels where the hardware cannot perform them reliably. The firmware maintains compatibility with modern ESPHome versions through active maintenance and timely adaptation to API changes.

RATING8.8/10
QUALITY8.7/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS18
VELOCITY0.77
OPEN ISSUES5
CLOSED ISSUES118
LAST COMMIT4 months ago
ruff (pip)
Files by Type (count)
Other (.jpg)
36
Markdown
25
C/C++ Header
20
YAML
9
Python
6
Other (no ext)
4
Other (.png)
2
Git Ignore
1
Makefile
1
TOML
1
Files by Type (size)
Other (.jpg)
6MB
Markdown
188KB
C/C++ Header
72KB
Other (.png)
36KB
Python
25KB
YAML
22KB
Other (no ext)
8KB
TOML
927B
Makefile
407B
Git Ignore
387B

The LLM identified 1 files worth highlighting for reuse:

Implements a flexible preset system for controlling light states with support for grouped presets and activation via next/previous or specific group/preset selection. Demonstrates the preset/configuration pattern where named configurations encapsulate device state. The system is reusable due to its clear separation between preset definition and activation logic, minimal dependencies (primarily on a controllable light interface), and well-encapsulated design that could be adapted to control any device with configurable states.

file: components/xiaomi_bslamp2/light/presets.h ↗ | tags: #preset-pattern #configuration-pattern
Last analyzed: 2026-08-04 23:03:57.991334
Next check: 2026-08-11 23:03:57.616739
$ submit: