Skip to main content
Pre-release

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 -i demo --status               # built-in simulated aGate, no hardware needed
fwh-async -i 192.0.2.10 --status         # your aGate (read-only); same syntax as franklinwh-modbus
fwh-async -i 192.0.2.10 --scan           # SunSpec base address and models
echo FRANKLINWH_HOST=192.0.2.10 > .env   # then just: fwh-async --status
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.10 for hosts
    • FWH-SN-REDACTED for serials
    • 00:00:5E:00:53:00 for 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.0a2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for franklinwh-modbus-async 0.2.0a2
File Size Uploaded
franklinwh_modbus_async-0.2.0a2.tar.gz 50.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for franklinwh-modbus-async 0.2.0a2
File Interpreter ABI Platform
franklinwh_modbus_async-0.2.0a2-py3-none-any.whl Python 3 none any Details

Total release size: 93.5 kB

Release files / franklinwh_modbus_async-0.2.0a2.tar.gz

Download URL franklinwh_modbus_async-0.2.0a2.tar.gz
Size 50.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b8f50ea22bb7679dc9d34bfd31b6f5900490383532670604ae4806a119eda1c9
BLAKE2b-256 checksum
How to use checksums
42059171856db75aa9f707ef5d7f98ccaeccb31810fef15a5ab6e9f38a912521
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

Release files / franklinwh_modbus_async-0.2.0a2-py3-none-any.whl

Download URL franklinwh_modbus_async-0.2.0a2-py3-none-any.whl
Size 43.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb553ea0e8b25f12bb2c136a770e1ff690d8bf39b232d5d519a9da6ec395db21
BLAKE2b-256 checksum
How to use checksums
1893f8f4e70adc8e83e0726a0298479c10c1939d77e97620b3a03261cdc404d8
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
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page