# BM2 Battery Monitor: reconstructing an encrypted BLE voltage protocol

> Reimplements the Bluetooth Low Energy protocol of the BM2 (Battery Monitor 2) car battery monitor for independent voltage readings. A Python client built on Bleak decrypts the monitor's AES-encrypted notifications to read the current voltage and request the stored voltage history, an ESPHome template exposes the voltage from an ESP32, and example apps view and dump readings or forward them over MQTT. The author's write-up reports that the key and packet layout were recovered from the vendor app; results are author- and contributor-reported.

- Type: Case study
- Targets: Protocol
- Category: Independent reconstruction cases
- Relationship: Independent reconstruction project
- Sources reviewed: 2026-10-20
- Added to the catalog: 2026-11-09
- Original resource: <https://github.com/KrystianD/bm2-battery-monitor>
- Primary source: <https://github.com/KrystianD/bm2-battery-monitor/blob/494a39c5edfbf5c76906469f0da545e42882b28c/README.md>
- Catalog page: <https://awesomerea.org/resources/bm2-battery-monitor-ble-case/>
- Record JSON: <https://awesomerea.org/resources/bm2-battery-monitor-ble-case/record.json>
- Chinese version: [简体中文](https://awesomerea.org/zh/resources/bm2-battery-monitor-ble-case/index.md)

## Requirements & limits

- The bm2 0.1.0 package requires Python 3.8+. The client reads current voltage and history; history timestamps are inferred at two-minute intervals, while the ESPHome template reads current voltage only.
- Supply a BM2 monitor and its Bluetooth address. The client and ESPHome template include the AES-128-CBC key recovered from the vendor app.
- The Python client uses Bleak ~0.14.2 and PyCryptodome; its reconnect path calls Linux bluetoothctl. MQTT adds paho-mqtt ~1.6.1. The ESPHome template targets a nodemcu-32s ESP32 with Arduino, mbedtls and Wi-Fi, MQTT and MAC secrets.
- The repository has a mypy check but no tests or CI. The history fix reports testing on Linux Mint 22.3 with a PowerHouse BM2 N2099A; coverage of other BM2 models is unspecified.
- Code is MIT under LICENSE.txt; the device and vendor app retain their rights.

## Primary sources

1. <https://github.com/KrystianD/bm2-battery-monitor/blob/494a39c5edfbf5c76906469f0da545e42882b28c/README.md>
2. <https://github.com/KrystianD/bm2-battery-monitor/blob/494a39c5edfbf5c76906469f0da545e42882b28c/.docs/reverse_engineering.md>
3. <https://github.com/KrystianD/bm2-battery-monitor/blob/494a39c5edfbf5c76906469f0da545e42882b28c/bm2_python/src/bm2/client.py>
4. <https://github.com/KrystianD/bm2-battery-monitor/blob/494a39c5edfbf5c76906469f0da545e42882b28c/bm2_python/src/bm2/encryption.py>
5. <https://github.com/KrystianD/bm2-battery-monitor/blob/494a39c5edfbf5c76906469f0da545e42882b28c/bm2_esphome/bm2.yaml>
6. <https://github.com/KrystianD/bm2-battery-monitor/blob/494a39c5edfbf5c76906469f0da545e42882b28c/bm2_esphome/main.yaml>
7. <https://github.com/KrystianD/bm2-battery-monitor/blob/494a39c5edfbf5c76906469f0da545e42882b28c/bm2_python/requirements.txt>
8. <https://github.com/KrystianD/bm2-battery-monitor/blob/494a39c5edfbf5c76906469f0da545e42882b28c/pyproject.toml>
9. <https://github.com/KrystianD/bm2-battery-monitor/blob/494a39c5edfbf5c76906469f0da545e42882b28c/LICENSE.txt>
10. <https://github.com/KrystianD/bm2-battery-monitor/pull/28>

## More in Protocols

- [Smart ring protocol: documenting the Oura Ring BLE protocol and event format](https://awesomerea.org/resources/ringverse-oura-ring-protocol-case/index.md) · Case study
- [openrsync: an ISC implementation of rsync protocol 27](https://awesomerea.org/resources/openrsync-protocol-case/index.md) · Case study
- [Thermal Master P3: a browser client for the vendor USB protocol](https://awesomerea.org/resources/thermal-master-p3-protocol-case/index.md) · Case study
- [SNX-VPN: reconstructing Check Point browser login for SNX](https://awesomerea.org/resources/snxvpn-case/index.md) · Case study
- [OpenDS: reconstructing an FRC Driver Station client](https://awesomerea.org/resources/opends-frc-case/index.md) · Case study
- [CO/Tech power plugs: reproducing captured radio commands](https://awesomerea.org/resources/cotech-remote-control-case/index.md) · Case study

## About this entry

The description was reviewed against primary sources.
Original editorial content: MIT. Linked projects, papers and assets retain their own rights and licenses.
