{"id":49212112,"url":"https://github.com/marcomc/bmgateway","last_synced_at":"2026-05-17T01:02:57.434Z","repository":{"id":352302691,"uuid":"1214614047","full_name":"marcomc/BMGateway","owner":"marcomc","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-18T21:21:08.000Z","size":629,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-18T23:28:21.480Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcomc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-04-18T20:15:07.000Z","updated_at":"2026-04-18T21:21:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/marcomc/BMGateway","commit_stats":null,"previous_names":["marcomc/bmgateway"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/marcomc/BMGateway","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcomc%2FBMGateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcomc%2FBMGateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcomc%2FBMGateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcomc%2FBMGateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcomc","download_url":"https://codeload.github.com/marcomc/BMGateway/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcomc%2FBMGateway/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32200159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-23T20:19:26.138Z","status":"ssl_error","status_checked_at":"2026-04-23T20:19:23.520Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-23T22:00:25.346Z","updated_at":"2026-05-17T01:02:57.425Z","avatar_url":"https://github.com/marcomc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BMGateway\n\n## Quick Index\n\n- [Overview](#overview)\n- [Choose Your Path](#choose-your-path)\n- [What Is Included](#what-is-included)\n- [System Flow](#system-flow)\n- [Repository Structure](#repository-structure)\n- [Documentation Map](#documentation-map)\n- [Development](#development)\n- [Release Status](#release-status)\n- [Credits And Attribution](#credits-and-attribution)\n- [License](#license)\n\n## Overview\n\n`BMGateway` is a Raspberry Pi battery-monitor gateway for BM200/BM6-family and\nBM300 Pro/BM7-family devices.\n\nIt ships as one Python codebase with two executables:\n\n- `bm-gateway` for runtime collection, configuration, history, and Home\n  Assistant publishing\n- `bm-gateway-web` for the optional local web application\n\nThe project is intentionally battery-first:\n\n- live polling from the Raspberry Pi\n- retained local history in SQLite\n- Home Assistant integration through MQTT discovery\n- a mobile-friendly local web UI for Home, History, Devices, and Settings\n\nFor the runtime, command-line, web UI, and Home Assistant boundaries, use\n[Application surfaces](docs/application-surfaces.md#application-surfaces).\n\n## Choose Your Path\n\n### I Want To Install It On A Raspberry Pi\n\nStart here:\n\n- [rpi-setup/manual-setup.md](rpi-setup/manual-setup.md)\n\nIf you want to prepare the SD card from macOS first:\n\n- [rpi-setup/macos-imager-cli.md](rpi-setup/macos-imager-cli.md)\n\n### I Want To Connect It To Home Assistant\n\nStart here:\n\n- [home-assistant/setup.md](home-assistant/setup.md)\n\nDeveloper reference:\n\n- [home-assistant/contract.md](home-assistant/contract.md)\n\n### I Want To Develop Or Modify The Project\n\nStart here:\n\n- [docs/application-surfaces.md](docs/application-surfaces.md)\n- [python/README.md](python/README.md)\n- [docs/README.md](docs/README.md)\n\n## What Is Included\n\n- Packaged runtime CLI and web executable\n- Live BM200/BM6-family and BM300 Pro/BM7-family polling paths\n- SQLite history with raw, daily, monthly, and yearly views\n- Optional Home Assistant MQTT discovery integration\n- Raspberry Pi bootstrap and `systemd` service installation\n- Local web app with:\n  - Home\n  - History\n  - Device Detail\n  - Devices\n  - Settings\n- Light/dark/system appearance modes\n- Modular web localization with a Settings language selector\n- Per-device colors, badges, and battery metadata\n- Battery, fleet, history, and device charts\n- Optional Raspberry Pi self-healing for scheduled reboots and Wi-Fi recovery\n\nFor the first release summary, use [CHANGELOG.md](CHANGELOG.md).\n\n## System Flow\n\nThis high-level flow shows the normal appliance path from battery monitors to\nlocal state, the web UI, and Home Assistant MQTT discovery.\n\n```mermaid\nflowchart LR\n    accTitle: BMGateway system flow\n    accDescr: Shows how battery monitor readings move through the runtime, local state, web UI, MQTT broker, and Home Assistant.\n    Devices[\"BM200/BM6 and BM300 Pro/BM7 devices\"]\n    Runtime[\"bm-gateway\"]\n    State[\"latest_snapshot.json and gateway.db\"]\n    Web[\"bm-gateway-web\"]\n    Browser[\"browser on bmgateway.local\"]\n    Broker[\"MQTT broker\"]\n    HomeAssistant[\"Home Assistant\"]\n\n    Devices --\u003e Runtime\n    Runtime --\u003e State\n    Runtime --\u003e Broker\n    Broker --\u003e HomeAssistant\n    State --\u003e Web\n    Web --\u003e Browser\n```\n\nThe full surface map lives in\n[docs/application-surfaces.md](docs/application-surfaces.md#application-surfaces).\n\n## Repository Structure\n\n```text\n.\n├── CHANGELOG.md\n├── README.md\n├── TODO.md\n├── docs/\n├── home-assistant/\n├── python/\n├── rpi-setup/\n└── web/\n```\n\n- `python/` contains the packaged application and tests\n- `home-assistant/` contains the MQTT contract and Home Assistant assets\n- `rpi-setup/` contains Raspberry Pi installation and operations docs\n- `web/` contains the web product boundary notes\n- `docs/` contains architecture, research, and development notes\n\n## Documentation Map\n\nUse one canonical source per topic:\n\n| Topic | Canonical document |\n| --- | --- |\n| First-release summary | [CHANGELOG.md](CHANGELOG.md) |\n| Active backlog | [TODO.md](TODO.md) |\n| Runtime, CLI, web UI, and integration surfaces | [docs/application-surfaces.md](docs/application-surfaces.md) |\n| Python package and contributor entry point | [python/README.md](python/README.md) |\n| Developer notes and architecture index | [docs/README.md](docs/README.md) |\n| Documentation maintenance rules | [docs/documentation-maintenance.md](docs/documentation-maintenance.md) |\n| Home Assistant setup | [home-assistant/setup.md](home-assistant/setup.md) |\n| Home Assistant MQTT contract | [home-assistant/contract.md](home-assistant/contract.md) |\n| Raspberry Pi installation | [rpi-setup/manual-setup.md](rpi-setup/manual-setup.md) |\n| Web product boundary | [web/README.md](web/README.md) |\n\n## Development\n\nPrimary maintainer commands:\n\n```bash\nmake install-dev\nmake check\nmake dev-deploy TARGET=admin@host\n```\n\nThe default quality gate is `make check`.\n\n## Release Status\n\nThe current documented release is:\n\n- `0.3.0`\n\nUse [CHANGELOG.md](CHANGELOG.md) for release content and [TODO.md](TODO.md) for\nwork that is not shipped yet.\n\n## Credits And Attribution\n\n`BMGateway` is an original project, but it builds on upstream open-source\nsoftware and protocol research that should be credited explicitly.\n\n### Open-Source Software Used\n\n- [Bleak](https://github.com/hbldh/bleak) by\n  [Henrik Blidh](https://github.com/hbldh) and contributors.\n  `BMGateway` uses `Bleak` as the Python BLE client/scanner foundation for the\n  Raspberry Pi live polling path. Thanks to the Bleak maintainers and\n  contributors for the library and surrounding troubleshooting knowledge.\n\n### Protocol / Reverse-Engineering References\n\n- BM6 reverse-engineering reference by\n  [tarball.ca](https://www.tarball.ca/posts/reverse-engineering-the-bm6-ble-battery-monitor/).\n  This informed parts of the BM6/BM200 protocol investigation. Thanks for the\n  published research.\n- BM6/Home Assistant community discussion:\n  [Home Assistant BM6 thread](https://community.home-assistant.io/t/bm6-battery-monitor-esphome/806239).\n  This helped validate practical behavior seen on live hardware. Thanks to the\n  community contributors for sharing findings.\n- BM300 Pro / BM7 reverse-engineering references:\n  [slydiman/bm7-battery-monitor](https://github.com/slydiman/bm7-battery-monitor)\n  and [derekpurdy/BM7](https://github.com/derekpurdy/BM7).\n  These provided the BM7 AES key, current-state poll command, payload offsets,\n  and model naming used for the BM300 Pro protocol driver. Thanks to those\n  project maintainers and contributors for publishing their findings.\n- BM2/BM6 community discussion:\n  [OpenMQTTGateway BM2 thread](https://community.openmqttgateway.com/t/omg-1-8-0-no-longer-gets-bm2-messages/3578).\n  This provided useful context during compatibility debugging. Thanks to the\n  contributors there as well.\n\n### Attribution Policy\n\nWhenever code, protocol logic, assets, or meaningful implementation ideas are\nadapted from other open-source projects in the future, they must be added to\nthis section with:\n\n- the project name\n- a link to the canonical Git repository when available\n- the author or maintainer name when known\n- a short note explaining what `BMGateway` reused or was inspired by\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcomc%2Fbmgateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcomc%2Fbmgateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcomc%2Fbmgateway/lists"}