$ show fl4p/batmon-ha
BatMON is a Home Assistant add-on and standalone Docker application for monitoring battery management systems (BMS) over Bluetooth Low Energy (BLE) and serial connections. It decodes telemetry from ~25 BMS families (Daly, JK, ANT, Renogy, Seplos, etc.) and publishes normalized data to MQTT for Home Assistant, or directly to InfluxDB. The architecture is a Python asyncio application with a BMS abstraction layer (`bmslib`) that defines a common interface (`fetch()`, `fetch_voltages()`) and model-specific decoders. The main entry point is `main.py`, which dispatches to HA add-on or standalone mode via `entrypoint.sh`/`addon_main.sh`. Data flows from BMS hardware through BLE/serial adapters into decoder classes, then to MQTT/InfluxDB via a GUI wire format (`bmslib/wire/model.py`). External dependencies include bleak (BLE), paho-mqtt, influxdb, and Home Assistant add-on infrastructure (bashio, supervisor). The project includes a Helm chart, Docker multi-arch builds, and a test suite with known-answer vectors for CRC/AES and protocol decoders.
The LLM identified 3 files worth highlighting for reuse:
Defines the core BMS abstraction (`BmsSample`, `DeviceInfo`, and the abstract BMS interface with `fetch()`/`fetch_voltages()`). This is the foundation for all BMS decoders and can be reused to add new battery protocols with minimal coupling.
Implements the GUI wire format (`node_state()`, `system_document()`) that normalizes BMS telemetry into a JSON structure for MQTT/InfluxDB. The pattern is transport-agnostic and can be extracted for any IoT telemetry pipeline.
Contains unit tests with fake BMS data and known-answer vectors for CRC, AES, and protocol-specific decoders. The test pattern is a solid reference for validating binary protocol parsers without hardware.