This release is a pre-release and may not be stable for production use.
franklinwh-modbus-async
An async Python library for the FranklinWH aGate. It talks Modbus TCP and covers the SunSpec models and the vendor extension registers. It is built on modbus-connection.
This is the asyncio successor to franklinwh-modbus, which is synchronous. It aims to match that library's features and to fix its known connection and threading defects. To find out why it exists and how it compares, read docs/why.md.
Status: pre-alpha (Phase 2 of 7). Connection, SunSpec discovery, typed status reads and a read-only CLI work. Battery control comes next. See PLAN.md for the roadmap.
⚠️ Unofficial software
About this software
- Not affiliated with, endorsed or supported by FranklinWH. FranklinWH and aGate are trademarks of their owners.
- Provided as is, without warranty, for educational and informational use.
Write commands carry real risk
- This library can send write commands to grid-connected battery hardware.
- Used incorrectly, it can discharge your battery when you need it, import power you did not intend to, or leave the system in an unexpected state.
- You use it at your own risk.
Getting help
- Do not contact FranklinWH support about this library. Report problems here.
Requirements
- An aGate with Modbus TCP enabled (ask your installer), reachable on TCP port 502. A fixed IP and a wired LAN are recommended.
- Python 3.12 or later.
Try it
pip install --pre franklinwh-modbus-async # Python 3.12+; --pre while in alpha
fwh-async scan demo # built-in simulated aGate, no hardware needed
fwh-async scan 192.0.2.10 # your aGate: SunSpec base address and models (read-only)
fwh-async info 192.0.2.10 # nameplate: model, firmware (serial hidden)
fwh-async status 192.0.2.10 # battery, grid, solar, home load, mode, control
import asyncio
from franklinwh_modbus_async import FranklinWH
async def main() -> None:
async with FranklinWH.tcp("192.0.2.10") as agate: # discovers the SunSpec map; never writes
s = await agate.snapshot() # one atomic read
print(s.battery.soc_pct, s.battery.power_w) # 55.0 -500.0 (+ = charging)
print(s.grid.power_w, s.home.load_w) # -2.0 498.0 (+ = import)
asyncio.run(main())
Develop
To work on the library from source:
git clone git@github.com:david2069/franklinwh-modbus-async.git
cd franklinwh-modbus-async
python3.12 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pre-commit install
pytest
Roadmap
| Phase | Scope | State |
|---|---|---|
| 0 | Scaffold, CI, PII guard, rationale docs | ✅ |
| 1 | Connection, SunSpec discovery, generated models, FakeAGate, read-only CLI |
✅ |
| 2 | Typed reads and snapshot, status/model CLI |
✅ |
| 3 | Control: M704 dispatch, watchdog, verify, native modes, safety | — |
| 4 | Virtual modes, TOU schedules, sequencer, discovery, IEEE 1547 curve models (703, 705–712) | — |
| 5 | CLI: control commands | — |
| 6 | Emulator and hardware verification | — |
| 7 | 1.0 release, migration guide | — |
Documentation
| Page | |
|---|---|
| Getting started | Prerequisites, install, first CLI and Python steps, testing with FakeAGate |
| Reading data | Snapshot, typed reads, sign conventions |
| aGate quirks | Deviations and the evidence for each |
| References | Standards and sources we cite (Modbus, SunSpec, FranklinWH PICS) |
| CLI | fwh-async commands and options |
| Architecture | Connection ownership, discovery, locking, retries, errors |
| Why this library | Purpose, basis, why async, why modbus-connection, and how it compares with the alternatives |
| modbus-connection findings | Notes from reviewing the transport library |
| Plan | Design decisions and phases |
| Changelog |
Contributing
PRs are welcome. CI runs ruff, mypy --strict, pytest and a PII guard (tools/pii_check.py).
- Placeholders only. In code, docs, examples and captured output, use:
192.0.2.10for hostsFWH-SN-REDACTEDfor serials00:00:5E:00:53:00for MAC addresses
- Private terms. Put anything you want blocked in a local
.pii-denylist. git ignores this file.
License
MIT. See LICENSE.
Metadata
Release files for franklinwh-modbus-async 0.2.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| franklinwh_modbus_async-0.2.0a1.tar.gz | 48.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| franklinwh_modbus_async-0.2.0a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 89.6 kB
Release files / franklinwh_modbus_async-0.2.0a1.tar.gz
| Download URL | franklinwh_modbus_async-0.2.0a1.tar.gz |
|---|---|
| Size | 48.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a94380ac4e79b43528630e4a2b0e30429815873c8b022c4472d5b2446264af4f
|
|
BLAKE2b-256 checksum How to use checksums |
7101ee3977d0089ec4b0accc342138eb8b849e3a6c4cff8da95a76e436856ad5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency logRelease files / franklinwh_modbus_async-0.2.0a1-py3-none-any.whl
| Download URL | franklinwh_modbus_async-0.2.0a1-py3-none-any.whl |
|---|---|
| Size | 41.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2823a3671b2ee7bbdee0ee07cad025cc2d280632ee50d51a4995770a4df9da7d
|
|
BLAKE2b-256 checksum How to use checksums |
5107cccb6b7ac1c02001866abf2885573a9b36c9951ec5d050bd13b88aa2fa6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency log