$ show emsesp/EMS-ESP32
EMS-ESP32 is embedded gateway firmware for ESP32 microcontrollers that connects EMS bus heating equipment (Bosch, Buderus, Junkers, Nefit, etc.) to home automation networks. In production it reads and writes EMS bus telegrams via UART, decodes device-specific values for boilers, thermostats, solar, heat pumps, ventilation, and water systems, and exposes them through MQTT with Home Assistant/Domoticz/openHAB discovery, a REST/MessagePack API, Modbus TCP/RTU, a serial/telnet console, and an embedded React/TypeScript web UI. It also provides OTA and recovery partitions, a scheduler and custom-entity system, analog and 1-Wire sensor support, user-defined formulas, and Prometheus metrics. The codebase is an application, not a data_research project; generated CSV/Modbus documentation artifacts and reverse-engineered protocol tables are build outputs, not analytics datasets. Architecturally it is a structured monolith: low-level UART/telegram stack, a device-driver registry, core services (network, MQTT, system, commands, sensors), an embedded web framework (`ESP32React`) with JWT security, and a separately built React SPA embedded as a compressed header. Main entry points are `src/core/main.cpp`, the `EMSESP` singleton services, REST `/api` endpoints, the console shell, and `recovery/main.cpp` for the recovery app. It depends on Arduino/ESP-IDF, ESPAsyncWebServer, ArduinoJson, espMqttClient, eModbus, uuid-* libraries, OneWire, and PSRAM helpers. The project is actively maintained but carries meaningful technical debt: vendored/patched third-party libraries, duplicated shim layers for standalone testing, build-time code generation hacks, and some large single-file modules with hardcoded hardware offsets.
The LLM identified 3 files worth highlighting for reuse:
A self-contained infix expression parser/evaluator using the shunting-yard algorithm. Supports operator precedence, functions, ternary expressions, and integration hooks for substituting EMS bus values. The algorithm core is independent of EMS-ESP and can be extracted for any user-defined formula/condition engine in C++.
A dependency-free MessagePack decoder written for the web UI's compact API payloads, with support for extension types such as dates, typed arrays, and structured clones. It is a clean, self-contained TypeScript module that can be reused in any frontend or Node project needing lightweight MsgPack parsing without adding a runtime dependency.
Small utility that caches Intl.DateTimeFormat and Intl.RelativeTimeFormat instances with bounded LRU eviction. This avoids the expensive construction of Intl formatters on every React render while preserving locale-aware formatting. It is portable to any frontend codebase and demonstrates a pragmatic performance optimization.