Result of my reverse engineering work on Bluetooth-based car battery monitor.
Battery Monitor 2 on Google Play
Supports the following API calls:
- Reading current voltage -
BM2Client.get_voltage()
- Reading voltages history -
BM2Client.get_history()
bm2_viewer.py
- data viewerbm2_history.py
- history readerbm2_mqtt.py
- mqtt sender
import asyncio
from bm2.client import BM2Client
async def main():
bm2 = BM2Client("B0:B1:xx:xx:xx:xx")
bm2.start()
# Read historical measurements
history_readings = await bm2.get_history()
for history_reading in history_readings:
date_str = history_reading.date.strftime("%Y-%m-%d %H:%M:%S")
print(f"{date_str} = {history_reading.voltage} V")
# Read current voltage measurements
while True:
voltage = await bm2.get_voltage()
print(voltage)
asyncio.run(main())
Install dependencies from apps/requirements.txt
- best in a virtualenv, then:
python apps/bm2_viewer.py --bm2-addr B0:B1:xx:xx:xx:xx
python apps/bm2_history.py --bm2-addr B0:B1:xx:xx:xx:xx
python apps/bm2_mqtt.py
--mqtt-host localhost \
--mqtt-port 1883 \
--mqtt-topic bm2 \
--bm2-addr B0:B1:xx:xx:xx:xx
If you are curious on how I did the reverse engineering process, read here.
BM2, Battery Monitor 2, com.dc.battery.monitor2, ICS Technology, Intelligent Control System