franklinwh-gateway-emulator
An emulator of the FranklinWH aGate for testing without hardware. It serves the Direct Connect local protocol (TCP/9000) and Modbus TCP (SunSpec chain plus FranklinWH extension registers), both in front of one closed-loop site model, so control commands actually move the battery and both ports always agree. It can run one gateway or a fleet of them.
With --cloud-port it also serves the FranklinWH Cloud API, the REST API the official
FranklinWH app, franklinwh-cloud and
homeassistant-franklinwh use, from the same
gateways: a cloud client, a Modbus client and a Direct Connect client all see one site. It never
contacts the real cloud. See FranklinWH Cloud API and
Cloud API clients.
As on a real aGate, Modbus TCP starts off. Every aGate runs a Direct Connect listener; Modbus
TCP comes on when a Direct Connect 1205 sunsMdEn write enables it (about 3 s later). That is
setup: factory, the default. A gateway that is already set up is setup: in-service: Modbus TCP
on from the start. modbus_enabled: true|false overrides either.
Built for franklinwh-modbus and
franklinwh-modbus-bridge. The
unmodified FranklinWHController connects, scans, reads and dispatches against it
(see tests/test_franklinwh_modbus.py).
Unofficial, and an emulation: it can never be 100% accurate. See the Disclaimer. It emulates documented and observed behaviour of the reference aGate's firmware. Where the sources disagree, the choices are in What is emulated.
Disclaimer
UNOFFICIAL SOFTWARE — NOT AFFILIATED WITH OR ENDORSED BY FRANKLINWH.
This is an emulator, not an aGate. It imitates FranklinWH's undocumented Direct Connect local API (reverse-engineered by third parties), its SunSpec Modbus TCP API (with undocumented FranklinWH extensions) and the FranklinWH Cloud API (the app's REST API, reverse-engineered from captured app traffic), from incomplete documentation and observations of a few real devices. It can never be 100% accurate: it may behave differently from a real aGate, now or in the future, and may have bugs, errors or omissions a real aGate doesn't have. Software that works here may still fail, or do harm, on real hardware. Verify on real hardware before relying on any result.
Provided AS-IS, without warranty of any kind. Use is entirely at your own risk; by using it you accept these limitations unreservedly. The authors accept no liability for any consequence, including anything done to real hardware by software developed or tested with it.
Do NOT contact FranklinWH support about this emulator. Raise issues at https://github.com/david2069/franklinwh-gateway-emulator/issues.
MIT License, with the additional notices in LICENSE.
Compliance & anti-circumvention
The emulator doesn't connect to a real aGate, but what you build with it may. Keep your gateway and battery settings, controls and operation compliant with the configuration set through the official FranklinWH mobile app and the installer/support portal. FranklinWH-managed settings may exist to protect the battery and gateway, apply software updates, enforce your local grid profile and import/export limits, and enforce incentive, subsidy or VPP/grid-programme restrictions. Bypassing or overriding any of them, deliberately or inadvertently, is entirely at your own risk, and is neither condoned nor encouraged by the authors.
Quick start
From PyPI (Python 3.10 or later), with one of the example fleets:
python3 -m venv .venv && .venv/bin/pip install franklinwh-gateway-emulator
curl -O https://raw.githubusercontent.com/david2069/franklinwh-gateway-emulator/main/examples/fleet.yaml
.venv/bin/franklinwh-emulator ui fleet.yaml # web UI: open http://127.0.0.1:8502/
From a clone, for the examples, the tests and development:
git clone https://github.com/david2069/franklinwh-gateway-emulator.git
cd franklinwh-gateway-emulator
python3 -m venv .venv && .venv/bin/pip install -e ".[dev]" # Python 3.10 or later
.venv/bin/franklinwh-emulator ui examples/fleet.yaml # web UI: open http://127.0.0.1:8502/
.venv/bin/franklinwh-emulator ui examples/fleet.yaml --cloud-port 8503 # plus the Cloud API
.venv/bin/franklinwh-emulator serve --port 5020 --dc-port 9000 --setup in-service # one gateway
.venv/bin/python -m pytest
Documentation
The full docs: https://david2069.github.io/franklinwh-gateway-emulator/. They are built
from docs/, so these links also work on GitHub:
| Getting started | install, run one gateway or a fleet, use it from Python |
| Model baseline | the hardware, and how location, weather, placement and controls drive the model, with a diagram |
| Configuration | describe each site: aGate, aPowers, PV, grid, accessories, location; where it's saved |
| Web UI | the optional web page, with screenshots |
| What is emulated | protocols, profiles and the choices where sources disagree |
| Grid, grid codes, export limits and phases | outages, trips, CSIP-AUS, phases |
| The site model | TOU, energy, location and time, weather, loads, generator |
Control API and ctl |
drive the emulator from scripts and tests |
| FranklinWH Cloud API · Cloud API clients | the cloud's REST API from the same gateways; pointing franklinwh-cloud, homeassistant-franklinwh or the official app at it |
| Scenarios · Replay | timed, checked test runs; recorded data |
| Direct Connect · Design · Calibration · Findings | reference |
| Changelog · Backlog |
Local preview: pip install mkdocs-material && mkdocs serve (live reload at http://127.0.0.1:8000/).
Metadata
Release files for franklinwh-gateway-emulator 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| franklinwh_gateway_emulator-0.3.3.tar.gz | 533.4 kB | With provenance | Details for franklinwh_gateway_emulator-0.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| franklinwh_gateway_emulator-0.3.3-py3-none-any.whl | Python 3 | none | any | Details for franklinwh_gateway_emulator-0.3.3-py3-none-any.whl |
Total release size: 958.3 kB
Release files / franklinwh_gateway_emulator-0.3.3.tar.gz
| Download URL | franklinwh_gateway_emulator-0.3.3.tar.gz |
|---|---|
| Size | 533.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9aaef12e1cc44cfe7746bb264593dd3f3d19bf5b22f90db4c283448eedf6df51
|
|
BLAKE2b-256 checksum How to use checksums |
fd9b588f079c14c8fcd9b1c718ebe7fa5abcdbf046309d1eb585c38653584390
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 24, 2026.
Transparency logRelease files / franklinwh_gateway_emulator-0.3.3-py3-none-any.whl
| Download URL | franklinwh_gateway_emulator-0.3.3-py3-none-any.whl |
|---|---|
| Size | 425.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b17b860f92794a171684995d4ec08cfe41b1cb493c06a9db4be8a0e6846954b9
|
|
BLAKE2b-256 checksum How to use checksums |
08020a07f41dfe79939329726971b820555602905af81376443ac4621696c701
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 24, 2026.
Transparency logSecurity for franklinwh-gateway-emulator 0.3.3
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for franklinwh_gateway_emulator-0.3.3.tar.gz
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 Nov 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.