Changelog¶
Unreleased¶
Added¶
- V12 profile: registers 17000–17099, with the 17022–17027 battery dispatch that franklinwh-modbus 0.16.0b1 uses (franklinwh-modbus#157; one site, V12R02B60D00). Writes charge, discharge or hold the battery until DispSoC is reached, and 15016 reads 6 while dispatching. An enabled M704 wins. The read-only points follow the site model. At the target the battery holds at 0 W, and when the timeout expires DispEna goes to 0 and the other settings keep their values, both as measured. A discharge target above the SoC is unknown and holds 0 W. While it runs, Direct Connect reports VPP (1707
ibgRunStatus9, empty 1301name), as during an M704 force; the app shows "VPP Mode". Other profiles still answer exception 2 (#388). See docs/emulated.md.
Fixed¶
- Direct Connect 1405: the docs no longer call the full-block write behaviour (
BBBackupSocapplies, min/max stay 0) proven on 2026-09-14. franklinwh-direct-connect-api 0.6.2 says that test has no raw record or firmware, so it is plausible. The behaviour is unchanged (#386).
0.3.3 (2026-11-25)¶
Added¶
- Published on PyPI:
pip install franklinwh-gateway-emulator. Av*tag builds the package, installs the wheel and runs its CLI, then publishes it through PyPI trusted publishing (#381). See docs/getting-started.md.
Changed¶
- The
devextra takes franklinwh-modbus 0.11.0 from PyPI instead of from git (the samefirmware_quirks.json); PyPI refuses packages with git dependencies. The README's links are absolute, so they work on PyPI too (#381).
0.3.2 (2026-11-24)¶
Added¶
- Web UI: Pin beside Map keeps the map at the top of the window while the gateway cards scroll beneath it, with every actions layout; the drawer still opens over it, and pinned the map is at most 40% of the window's height (phones included). Remembered by the browser (#365). See docs/ui.md.
examples/fleet-global.yaml:examples/fleet.yamlplus every US, Canadian, Australian and New Zealand home from the two regional examples, 71 gateways in one fleet (#363). See docs/configuration.md.- Web UI: an actions drawer. Right-click a gateway card or a map marker (a long press on a touch screen) to open its actions at the side of the window, left or right; nothing is greyed out, and Esc or × closes it. The header's Actions drop-down (was a right/below toggle) adds Left and Drawer (#361). See docs/ui.md.
examples/fleet-au-nz.yaml:examples/fleet.yamlplus two different homes in each of Devonport (Auckland), Hamilton, Christchurch, Queenstown, Perth, Townsville, Canberra, Adelaide, Hobart and Darwin: aPower X-01-AU or X-02-AU (some mixed), V10R01 or V12R02 firmware, solar or none, remote PV, large arrays, a generator, V2L, smart circuits or none, the three modes and export settings; AS/NZS 4777.2 Australia A throughout, the only region the emulator has (New Zealand's region and Australia B/C are not emulated) (#357). See docs/configuration.md.-
Web UI: Map (header), an optional view of where the gateways are installed, from each one's location: one marker per place with each gateway's id and SoC, click to select; offline (a shipped Natural Earth outline, Leaflet 1.9.4 loaded on first use), as the Direct Connect bridge's CloudFront PoP map (#352). See docs/ui.md.
-
A site can have no TOU plan:
tou_schedule: [](#368). TOU mode then self-consumes; the control API'stoustate has an empty schedule and no active block; Direct Connect 1408 has no blocks; the Cloud API'sgetTouDispatchDetailhas an empty template and no seasons. The no-plan shapes and the TOU-mode behaviour are plausible, not verified on an aGate. Thetouaction'sschedule: []removes a plan; a plan set later (control API or cloud) applies as before. Omittingtou_schedulekeeps the default schedule. See docs/site-model.md.
Changed¶
- Example fleets: each US, Canadian, Australian and New Zealand home has a city-level postcode (Canada: the forward sortation area), different for a city's two homes where the city has more than one, so the gateway picker's Postcode filter and grouping by postcode have something to use (#375). See docs/configuration.md.
- Web UI: Force events chooses its gateways with the gateway picker's filters (Country, State / province, Postcode, Timezone) and a multi-select drop-down ("20 of 71 gateways selected · 1 hidden by filter") with Select all matching and Clear, instead of a checkbox per gateway; keyboard accessible, Esc or a click outside closes it. Selections a filter hides stay selected; every gateway selected still sends
targets: all(#374). See docs/ui.md. examples/fleet-us-canada.yaml,examples/fleet-au-nz.yamlandexamples/fleet-global.yaml: every TOU home has its own TOU plan and prices (plausible, not published tariffs: e.g. a 16:00-21:00 peak without grid charging in California, 15:00-21:00 in Perth, overnight or midday grid charging elsewhere); most Self-Consumption and Emergency Backup homes have none, and five Self-Consumption homes keep one from before they left TOU (#368). See docs/configuration.md.examples/fleet-north-america.yamlis renamedexamples/fleet-us-canada.yaml: it has homes in Hawaii and Puerto Rico as well as the mainland US and Canada (#363). See docs/configuration.md.- Docs: which AS/NZS 4777.2:2020 region each network requires (Western Power Australia B, Horizon Power and TasNetworks Australia C, Vector Australia A; Power and Water and the other New Zealand networks not established), with sources, in docs/grid.md. Australia B, C and New Zealand are not added: no public document reproduces their settings.
examples/fleet-au-nz.yamland docs/configuration.md say which homes that affects (#359). examples/fleet-north-america.yaml: operating modes mixed (Self-Consumption, TOU, and Emergency Backup mostly on homes without solar), grid charging prohibited for the California homes, two homes in each of Honolulu, Hilo and Kahului covering every North American aPower model (some without solar; IEEE 1547 Category III, plausible) and two in each of San Juan and Ponce, Puerto Rico: 51 gateways (#351). See docs/configuration.md.examples/fleet-north-america.yaml: export settings mixed (the North American factory default of no battery export, battery export on, solar export capped at 5 or 10 kW, zero export), 10 homes without smart circuits, aPower S DC PV at the MPPT maximum (15 kW per aPower S: 30 and 45 kW) and 12 to 15 kW rooftop arrays. Two DC PV homes hadsolar_peak_w: 0, which silences DC PV (it follows the site's solar shape); they now have no AC solar through a 0 PV share (#349). See docs/configuration.md.
Fixed¶
- Web UI: on a phone with the map on, the header's view options (with the map's Pin button) were wider than the screen and didn't wrap, so the page scrolled sideways and the actions drawer sat 31 px off the left edge at 390 px. They wrap onto a second line (#373).
- Web UI: the site header showed the array size unrounded (e.g. "PV 4.511405733736995 kWp"); it shows 0.1 kWp like the diagram (#369).
- Tests:
test_values_come_from_the_sitefailed now and then: it checked the Cloud API'stempFagainst the roundedtempCwithin 0.1 °F, where rounding allows 0.14 (#366). - Web UI: a gateway without a hardware model (the
specprofile) no longer throws in the card's model line, and the gateway picker and grouping take non-text location values.examples/fleet-north-america.yamlquotes Ontario's"ON", which YAML read as true (#355). See docs/configuration.md.
0.3.1 (2026-11-20)¶
Added¶
- Cloud API: the official app's start-up calls, the 17 it makes in 34+ of 42 captures that weren't served (#333, #316 step 3):
getDeviceInfoV2(the aGate and aPowers from the site's models),chargePowerDetails(displayed SoC and active reserve),tou/getEntranceInfo,weather/getCurrentBriefWeather(the site's sky and temperature),bill/electric/selectBenefitInfo(the day's solar and aPower kWh),common/selectDeviceRunLogList,common/getPowerCapConfigList, and the account extras answered as none (selectProgramFlag,nps/getNpsShowTip,getShowTip,feedback/whetherPopUp,getAppGlobalConfig,message/selectMessage,appObtainAdvertiseLst,common/getPageByTypeList,updateTerUserFcmToken,tou/notify/ai/cache). Shapes from the app's captures (names and types only). See docs/cloud-api.md. - Cloud API: the official app's next 14 calls (#337, #316 step 3), made in 19 to 30 of the 42 captures:
obtainAgateInfo,obtainApowersInfoandselectDeviceOverallInfo(the aGate and aPowers from the site's models and firmware),selectGatewayAlarm(the active alarms),backupHistorySummary(the grid relay's openings),site/get/DeviceDetail(the location, city level),tou/getBonusInfo,tou/calculate/expected/earnings(no savings),getPersonalInfo(nothing filled in),getUserResources/v2,selectSimBtn,sim/cardShow(HTTP 404, as captured),recommend/recommendFlagandv2/loginOut; and sendMqtt 317 (network interfaces and the install profile), 327 (the aPower LED) and 337 (the aGate's Wi-Fi), whose writes are kept. See docs/cloud-api.md. - Cloud API: the rest of the official app's calls (#341, #316 step 3), made in 1 to 18 of the 50 captures: the account's sites and devices (
site/list/siteAndDeviceInfo,listAppUserDevice,site/get/SiteDetail), location, geography and grid compliance (getEquipmentLocationDetail,obtainGeographyList, thenewCompliancepair,getCompliance), device and settings reads (getDeviceInfo,getGatewaySystemSetting,solar/selectAnyOneSolarOpen,selectIotUserRuntimeDataLog,v2/warrantyInfo,getHotSpotInfo), energy history (selectWorkingHours,iotDayPowerStatistics,electricStatistics,countLoad), backups (iotChargePowers,chargePowerTotal), the event log as device messages and the notification settings, the TOU dispatch helpers, and the rest answered as none (push messages, tariff catalogue, SPAN, VPP tip); the in-app assistant (api-smart/terminal/...); and sendMqtt 315 (maintenance: reboot, clear alarms), 335 (Wi-Fi scan), 339 (network status) and 341 (network switches). Shapes from the captures (names and types only). See docs/cloud-api.md. - Cloud API: the installer app's calls (#343, #316 step 3), the 30
hes-gateway/manage/paths in 1 to 13 of the 50 captures andmanage/sendMqtt: the installer's gateway list and status counts (selectAppGatewayList,selectAppGatewayStatus), countries and states, install and upgrade status, the smart-circuit block (getCommunicationOptimization), and themanage/twins of the user app's calls. Every one of the 143 captured method + paths is now served. See docs/cloud-api.md. examples/fleet-north-america.yaml:examples/fleet.yamlplus 15 split-phase homes across the US and Canada, each with its own timezone (Redding CA, Boise, Houston, Tampa, Buffalo, Chicago, Seattle, St Louis, Cincinnati, Atlanta, Oklahoma City, Ottawa, Halifax, Long Beach NY, Atlantic City; Phoenix is the existingus-split) (#335). See docs/configuration.md.
Changed¶
- Docs: the FranklinWH Cloud API is in the README (intro, quick start, docs table, disclaimer), the docs home, Getting started (
--cloud-port,Fleet.start(cloud_port=0)) and What is emulated (a Cloud API row; only uncaptured calls left as not modelled) (#345). examples/fleet-north-america.yaml: two or more homes in each of its 16 places, 31 in all with Phoenix's second, each one different: aGate and aPower models (some mixed), V10R01 or V12R02 firmware, solar or none, remote PV, aPower S DC PV, a generator, V2L and smart-circuit loads (HVAC, EV charger, hot water, pool and well pumps) (#338). See docs/configuration.md.
0.3.0 (2026-11-18)¶
Added¶
- UI: a start-up screen, from the owner's design board F: a welcome, the active gateway's last 7 days of solar and home use (kWh a day), and the emulator's own mark with "Unofficial · not affiliated with FranklinWH" and the version. First load of a browser session only; fades once the page has loaded, or on a click or Esc. New control API read
GET /gateways/<id>/days?n=7(#329). See docs/ui.md (Start-up screen), docs/control-api.md (Days). - Docs: Cloud API clients (new page): how each kind of client reaches the Cloud API: by base URL (franklinwh-cloud, richo's franklinwh library), by DNS and a TLS front with a test CA for clients with no base URL setting (homeassistant-franklinwh, richo's library unmodified; the openssl commands and a standard-library Python front), and the official app through HTTP Toolkit; which are tested and which aren't (#327). See docs/cloud-clients.md, docs/cloud-api.md.
- Cloud API: richo's franklinwh library (2026.3, the homeassistant-franklinwh integration's client) works against it; every call it makes is served (#322). New:
common/getAccessoryList(the fitted accessory modules),manage/getEquipmentListandterminal/getIotAccessoryList(the same list; their real shape isn't known),tou/setPowerControlV2(export mode and limits into the site'sutilitysettings) andtou/updateTouMode(parameters in the query or a form).getPowerControlSettingaddsgridFeedMaxFlag,gridFeedMax,gridMax,gridMaxFlagand the app's other keys;sendMqtt311 adds the cloud's own keys (runingMode,modeChoose,touMinSoc…) and answers a write with the whole block. Shapes from the app's HTTP Toolkit captures where the app makes the call. franklinwh is a dev dependency for the test. See docs/cloud-api.md. - Cloud API calls not emulated yet (a path answered 404, a
sendMqttcommand answeredcode 400) are counted and shown: a list in the UI's Monitor, a count in each gateway's Cloud API column,Cloud API call not emulated: …events, andfranklinwh-emulator monitor;GET /monitorcloud.unserved(#316). See docs/cloud-api.md. --cloud-host HOST(ui,fleet,serve) andFleet.start(cloud_host=…): the Cloud API on an address other than loopback, e.g. for HTTP Toolkit forwarding the official app from another machine; the start-up output warns when it isn't loopback (#316). See docs/cloud-api.md.- UI: the FranklinWH Cloud API shows like Modbus TCP and Direct Connect: its address on the card and detail (
Cloud API 127.0.0.1:8503or off), acloud: …badge and card colour while a cloud fault is set, a "Cloud API clients" Monitor column (login sessions, with the app version each claims; 429s as refused) and totals (logins, requests),franklinwh-emulator monitorrows, andCloud API client … connected / left / refusedevents. Statecloud_address;GET /monitorcloud(#314). See docs/cloud-api.md, UI. - FranklinWH Cloud API: broken replies below the envelope.
cloud-faultsgainsbad_reply(hang,reset,truncate,not_json,not_envelope,html_500/502/503/504,success_false, and forsendMqttwrong_cmd_type,bad_crc,bad_data_area),bad_reply_countandbad_reply_p;cloud: {rate_limit_per_min}in the fleet file is a rate limit for the whole account (#311). See docs/cloud-api.md, Configuration, Control API. - FranklinWH Cloud API, phase 3: faults. The
cloud-faultsaction (ctl <gw> cloud-fault k=v):offline(code 136),timeout(code 102),rate_limit_per_min(HTTP 429 withRetry-After),latency_s,empty_composite(result null); statecloud_faults; andcloud: {token_ttl_s}in the fleet file expires tokens (code 10009) (#309). See docs/cloud-api.md, Configuration, Control API. - FranklinWH Cloud API, phase 2c: Storm Hedge settings, the generator (
selectIotGenerator,updateIotGenerator, which changes the same generator block as Direct Connect) and the grid limits (getPowerControlSetting,setPowerControl: grid charging off or capped on the site) (#307). See docs/cloud-api.md. - FranklinWH Cloud API, phase 2b: TOU schedules,
getTouDispatchDetailandsaveTouDispatchwith seasons and weekday/weekend day types; the site runs the season and day type for its date, with the prices; franklinwh-cloud'sset_tou_schedule,set_tou_schedule_multi,get_tou_infoandget_modein TOU work against it (#305). See docs/cloud-api.md. - FranklinWH Cloud API, phase 2a: writes.
updateTouModeV2andupdateSocV2(mode and reserve, including a fixed-time emergency backup),updateOffgrid, and thesendMqtt311 smart-circuit write, with their read-backs (getGatewayTouListV2,getStormSetting); franklinwh-cloud'sset_mode,get_mode,update_soc,set_grid_statusandset_smart_circuit_statechange the site (#303). See docs/cloud-api.md. - FranklinWH Cloud API, phase 1c: energy history,
getFhpPowerByDay(the day's SoC and flows) andgetFhpElectricData(kWh by day, week, month, year and total, with the cloud's date rules), from the site's quarter-hour history; the history now also records SoC and V2L (#301). See docs/cloud-api.md. - FranklinWH Cloud API, phase 1b:
sendMqtt211 (electrical readings), 311 (smart circuits) and 203, andselectOffgrid, so franklinwh-cloud'sget_stats(include_electrical=True)works and a requested off-grid reads as simulated, not an outage (#299). See docs/cloud-api.md. - FranklinWH Cloud API, phase 1a:
--cloud-port(andFleet.start(cloud_port=)) serves the cloud's REST API from the fleet's gateways on 127.0.0.1, for clients pointed at it by their base URL: login (the fleet file'scloud: {account, password}),getHomeGatewayList,getDeviceCompositeInfofrom the live site, and thesendMqtt353 smart-circuit loads; the cloud's envelope and error codes (401 wrong password, 10009 no token). franklinwh-cloud'sget_stats()works against it; franklinwh-cloud is a dev dependency for that test (#297). Docs: FranklinWH Cloud API (new), Configuration, What is emulated, Home. - V2L (
v2l:per gateway: circuit, ev_kwh, ev_soc, max_w, min_soc): the EV on a smart circuit supplies the house's shortfall off-grid, while no generator runs, until its SoC floor; the EV doesn't charge on that circuit meanwhile; needs the smart circuits and the generator module;v2laction andctl <gw> v2l on|off [soc=..]; statev2l; Direct Connect 1411 reports it on the car switch; the diagrams draw it as board E (amberSC 1 · V2L · Supplying, EV SoC, reversed flow), and V2L leaves the not-modelled list. The EV values are placeholders to confirm. examples/fleet.yaml and au-3phase-group.yaml: V2L on L3 (#287). Docs: Weather and loads (V2L), Configuration, Control API, What is emulated, Web UI. circuitaction:wsets the watts a smart circuit draws, replacing its appliances, untilw: null(also on a gateway with noloads:); it obeys the switch, the islanded SoC cutoff and off-grid shedding; statecircuits.N.set_w;ctl <gw> circuit 2 on w=7000/w=auto. Acircuitbody now needson,wor both (was:onrequired) (#279). Docs: Weather and loads (Smart circuits), Control API.weatheraction:model(bell, synthetic, open-meteo),latitudeandlongitudechange a gateway's weather while it runs, also one with noweather:or location (the coordinates are the weather's only);ctl <gw> weather model=.. latitude=.. longitude=..; on the bell curve,skyalone now says to set a model first (#278). Docs: Weather and loads (Seeing and changing the weather while it runs), Control API.- Web UI: each gateway card has a
Weather:line: the model (Open-Meteo, synthetic with its sky, bell curve), "Open-Meteo unavailable" when it fell back, and a weather event in force with its end (#277). Docs: Web UI. weather_events(per gateway or per group): darker skies on top of the weather model, fixed ({sky, at: "HH:MM", for, every, times}) or random from the seed ({sky, for: 30m..3h, chance, per: day}); stateweather_event, start and end in the event log, the UI weather line, checked byvalidate; example in examples/fleet.yaml (#270). Docs: Weather and loads (Weather events), Configuration, Web UI.- README badge row: latest release, the test and docs workflows, the Python floor and the license (#261).
franklinwh-emulator monitor: who is using a running emulator, from the shell: clients connected now per gateway and listener, accepted and refused counts, requests, the last client;--historylists each gateway's client events,--watch Nredraws,--jsonprints the raw reply (#257).
Changed¶
- V2L follows the FranklinWH app's V2L page (new firmware, owner's AU site): states
Disabled/Standby/Active(were Disabled / Ready / Supplying);charge_apower(the app's Allow charging to aPower, default on) lets V2L also charge the aPower withinmax_w(before: the house's shortfall only); the state adds the app's Vehicle Datavoltage_vandfrequency_hz(0 unless Active); the docs note AU V2L support from the new firmware (#289). Docs: Weather and loads (V2L), Configuration. - Weather (open-meteo): today and later are fetched again once their cached copy is
refresh_hhours old (default 2; was: fetched once and kept), by a running site too; today's request also caches tomorrow; a failed refresh keeps the older copy. Past days are still fetched once (#269). Docs: Weather and loads, Configuration. - Weather: a site with a location and no
weather.modelnow usesopen-meteo(wasbell); without a location it staysbell. A day Open-Meteo can't serve (no network, an API error,offlinewith nothing cached) runs on thesyntheticsky, is logged once, adds aweatherevent, showsweather.fallbackin the state and in the UI, and is fetched again after 10 minutes.FRANKLINWH_EMULATOR_OFFLINE=1setsofflinefor every site. Built-in scenarios pinweather: {model: bell}so their checks repeat exactly (#268). Docs: Weather and loads, Configuration, The site model. - Group diagram: the active aGate is drawn in cyan (outline, title and its phase line from the meter) instead of only a thicker green outline; under FORCE its outline stays orange (#267). Docs: Web UI, grouped site.
Fixed¶
- Cloud API: a missing, empty, unknown or expired
loginTokengetscode 401,Please enter a valid user authorization token!and noresult, as the app's captures show, notcode 10009; richo's franklinwh library logs in only on 401, so it never logged in (#323). See docs/cloud-api.md. - UI: the Cloud API showed as off (card, detail, Monitor) when the emulator was started from the command line with
--cloud-port; it was set only when started from Python (#318). monitorandctl: a running emulator that doesn't answer within 5 s now gets a message saying so instead of a Python traceback;monitor --watchshows it and tries again at the next round, and Ctrl-C ends--watchquietly even mid-request (#293). Docs: Control API.- Weather (open-meteo): with Open-Meteo unreachable, start-up waited 20 s per site and day before opening any listener, the running emulator stalled (the control API and
monitortimed out) and Ctrl-C was ignored until a fetch gave up; fetches now run in the background, the site runs on the synthetic sky until the data arrives, and a network failure pauses fetching for every site for 10 minutes with one warning (#291). Docs: Weather and loads. - examples/fleet.yaml: the au-3phase site now follows board E: L1 has no smart circuits (solar only), L2 has aircon and hot water + induction on smart circuits 1 and 2, L3 the EV on smart circuit 1 with the generator module fitted (V2L not modelled); before, every aGate had both circuits and no loads on them (#285). Docs: Testing the UI.
weatheraction on a grouped site now changes every aGate in the group (one sky, as the fleet file's sharedweather), not only the active one; a refused body (e.g. an unknown sky) now changes nothing (#283). Docs: Weather and loads, Web UI (grouped site).- Group diagram: the aPower name was too big for its tile; it is now 13 px (#264).
- Group diagram: on an aGate with smart circuits and AC solar, the phase's Home Loads tile overlapped the AC solar tile; it now ends before it (#263).
monitorandctlwith no emulator running now say so and how to start one in another terminal, instead of only "Connection refused"; the start-up output ends with themonitorcommand to run, andmonitor --helpand the docs say it needs a running emulator (#259).
0.2.3 (2026-11-02)¶
Added¶
- Web UI: a grouped site is drawn as one, after board E of the owner's design (#241): grid and the service meter (
3 × 63 A · 400 V, site import, Home Loads across all phases), then one row per aGate with its phase line, amps and import, its aPowers, AC solar or its smart circuits and loads, and its phase's Home Loads (not on board E); the active member outlined. State addssolar_peak_wandnominal_v_ln. - Grouped aGates share one grid connection (#241): a
gridaction on any member (outage, voltage, frequency, restore) reaches the whole group,phasepicks the member on that leg, frequency is common; each member's state hasgroup;GET /groupsreports each phase (aGate, grid, load, solar, battery, SoC) and the service meter's totals (3 × 63 A · 400 V). - Fleet
groups:(#241): aGates at one site and grid connection, one per phase (group:+phases: [L1]), share the group's location, weather, grid code, utility, service (per phase), clock and sky;validaterefuses a member that sets a group setting, a shared phase or more than one leg. Example:examples/au-3phase-group.yaml(solar on L1, air conditioning and hot water on L2, EV on L3). Grid events and the combined meter are not shared yet.
Changed¶
- AU/NZ aGates are single phase (owner, 2026-11-02): an AU/NZ model with more than one leg (
ac_type1 or 2, orphaseswith two or three legs) is refused, naming the fix: one aGate per phase in a fleet group.examples/fleet.yaml'sau-3phaseandau-2phaseare now groups of 3 and 2 aGates (au-3phase-l1…), and thephase-loss-3phscenario islands only L2's aGate while L1 and L3 stay on the grid. Multi-leg layouts remain for North American grid codes and thespecprofile (#242).
Fixed¶
- The main breaker trips each pole on its own leg's import against
main_breaker_a; it compared the total import with the rating of all legs, so 18 kW on one leg of a 100 A split-phase service (150 %) never tripped (#240). solar_peak_w: 0is a site without solar; it was ignored and the seed picked 3.5–6 kW of PV (#238).
0.2.2 (2026-11-02)¶
Added¶
- aPower S DC PV (
dc_pv: {rated_w, export}), from the datasheet ratings: up to 15 kW per aPower S, sharing its 11.5 kW inverter with battery discharge, charging the battery directly, curtailed beyond inverter + charging;export: falseserves only house and battery. Counted in solar. - Mixed aPower models:
model: {apower: [0, 3]}gives one model per aPower; capacity, discharge and charge power add up per unit, DC 1102PE_HW_VERlists each unit, and counts follow the Backwards Compatibility Statement (15 max; X + 2 on aGate X 1.1, 8; up to 8 aPower S). - North American aGates open the PV relay when aPower discharge + grid import + solar exceeds the 280 A busbar rating (PCS Technical Brief), for 300 s.
power_limits: settable | locked: a locked site acknowledges Direct Connect 1701 limit writes without storing them; shown in the state. A setting, not derived from the region (no evidence of which regions lock or how a lock looks).pv: {model: pvlib}(optional extra.[pvlib]): pvlib computes the synthetic weather's array irradiance (Erbs split, Hay-Davies/Perez/isotropic transposition) and the cell temperature (SAPM, Faiman, PVsyst); the built-in model stays the default. pvlib joins the dev extras so CI tests it.time-machineaction (years, days or to a date; reset): moves a gateway's clock ahead without simulating the gap, so components age (SoH, PV, warranty) while SoC and counters stay; the card shows "time-travelled +N years".- Component age and warranty (
components:): aPower SoH falls to 70 % over FranklinWH's warranty term (12 y / 43 MWh aPower X, 12 y / 60 MWh X-02-AU, 15 y / 60 MWh aPower 2 and S) by age or throughput; served in 713 SoH, 15036 and DC 1705 batSoh, and the usable capacity follows it (against the 94.8 % calibration). PV panels lose 0.5 %/year. The state shows each component's warranty. Behaviour change: SoH is no longer a fixed 95.6/94.8. - Force events (side panel,
POST /events): ten presets (offline, slow, faulty responses, DC offline/slow, aPower failure, grid outage, brown-out, frequency drop/spike) on all or chosen gateways, with optional auto-clear; logged per gateway asevent:<name>. - Session snapshots (UI "with state",
POST /session/save {snapshot: true}): each site's clock, SoC, counters, today's totals, 1303 history, circuit/generator energy, EV sessions, sky and cabinet temperature, versioned; restore puts them back after the actions (manual/scaled clocks move to the saved time). - Save as scenario (UI button,
POST /session/scenario): writes the run asscenarios/<name>.yamlwithstart, the fleet and the logged actions as timed steps, replayable withfranklinwh-emulator scenario. - timeseries.csv appends
cabinet_c,sky(with a weather model) and the running lifetime counters (grid_import_wh,grid_export_wh,pv_wh,batt_charge_wh,batt_discharge_wh,generator_wh); existing columns are unchanged. firmwarecontrol action (and UI form): switch a gateway to another aGate profile while it runs, like an update. Both listeners cycle; the new profile's Modbus image, versions and Direct Connect behaviour apply; the site's state is kept; sessions save it.- Commissioning lifecycle:
setup: commissioning, thecommissionaction (start, the app's System Parameters, PTO date, complete) and the state'slifecycle;pto_datein the fleet file. Only the state and settings change (the guide documents no per-state protocol behaviour, nothing before/after PTO). pcs_derate_w, the installer's PCS Permanent Derate (Commissioning Guide p. 24): caps each aPower's charge and discharge, on- and off-grid, and stacks with temperature derating; above the unit's rating it has no effect. The state shows it.- Direct Connect 1701 → 1702 install profile: the catalogue's key set from the site (
electricSupply= service amps,gridExportEnable,isPcsDischgEn); the four −1 power-plane limits are stored by a full-block write with Debug Mode on, and not enforced. service.busbar_a: on North American models with no utility export limit, the PCS export limit is ((busbar × 1.2) − main) / 1.25 A across the legs (PCS Technical Brief; 200 A / 200 A → 7.68 kW). The state showspcs_export_limit_wandservice.busbar_a.- North American aGates open the PV relay when PV must be curtailed to hold the PCS export limit (PEL) and the battery can't absorb it (PCS Technical Brief); it recloses after 300 s. AU/NZ curtail smoothly as before.
- North American aGates off-grid open the PV relay of inverters that don't follow IEEE 1547 (
pv_non_1547) on a surplus, and every producing input when the surplus is beyond what droop can remove before 62.2 Hz (PV above charging capacity); each closes after 300 s, so a lasting surplus toggles it. The state'spv_relays_auto_opennames them; 1707/1708 read them open. accessories: {smart_circuits, generator_module, apbox}sets which modules a gateway has (default all fitted). Without smart circuits there are none, and Direct Connect sends their keys inert and zeroed; a generator needs the generator module; remote PV inputs need an aPbox. The state showsaccessories.- North American aGates off-grid droop surplus PV by frequency (PV Curtailment White Paper): 60 Hz + 0.036 Hz + 3 Hz per rated PV curtailed, ramped at 0.2 Hz/s, shown on 701.Hz, 1707
gridFreq, the state'sdroop_hzand the card's curtailment line. - AU/NZ aGates limit the generator to the Generator Module's 80 A continuous rating (18.4 kW at 230 V): a fleet file or control API
rated_wabove it is refused; a Direct Connect 1901 write above it is capped at output. franklinwh-emulator validate FILE...checks fleet, scenario, session and recording (replay CSV/SQLite) files without starting anything and prints every problem asfile: path: what is wrongwith what is allowed (closest key for a typo, YAML line and column); a clean recording reports rows, span, the largest gap and its columns, and a fleet'sreplay:recordings are checked too.fleetnow checks its file first, asuidoes (it stopped at the first problem with a traceback). New page: Checking files and startup output, which explains every startup line (#200).- Cards show each model's SKU beside its name, e.g. "aGate X-01-AU (AGT-R1V1-AU) · 2× aPower X-01-AU (APR-05K13V1-AU)": the SKU carries the country code and is what FranklinWH documents name; it was only in the tooltip (#191).
- Model catalogue and Sources and regions follow the FranklinWH AU system datasheet (aPower X-02-AU: SKU APR-05K15V1-AU, 15 kWh, 5 kW, peak 10 kW for 10 s), the MAC 1 commissioning guide and the aHub manual; SKUs without a known code are listed (#180).
- PCS grid-charge settings:
utility.grid_charge: falsekeeps the battery to solar or generator charging, andgrid_charge_max_wcaps grid-sourced charging (the app's Grid charge and Max charge power, FranklinWH PCS Technical Brief) (#123). - Off-grid full-battery PV cut-off on North American models: at 100 % the aGate forms 62.2 Hz and AC PV stops until SoC is below 97 % (FranklinWH PV Curtailment White Paper); 701.Hz and 1707
gridFreqshow it. AU/NZ models still only clip PV to the load (#178). - Hardware models: each gateway has an aGate and an aPower model (
model: {agate, apower}), keyed by the codes FranklinWH reports (aGatesysHdVersion100–104, aPowerpeHwVersion0–7), with SKU and name as labels. Defaults by region: AU/NZ 102 + 2, North America 103 + 0. The aPower model sets kWh, kW and charge kW per unit (aPower 2 charges at 8 kW). Direct Connect 1102 serves the codes, cards show the model, andvalidaterefuses mismatched regions or frequencies. Defaults keep today's 13.6 kWh / 5 kW (#180). - Docs: Sources and regions, which cites the FranklinWH PV Curtailment White Paper and PCS Technical Brief, scopes them to North America (US, Canada) apart from AU/NZ models, and lists the aGate/aPower model codes (#181).
- Cards: the border turns red when the gateway is faulted (alarm, main breaker tripped, injected fault) and dashed orange when offline (rebooting, episode down, listener offline); the tooltip says why (#168).
- Example fleet: every gateway has a service rating (63 A AU, 200 A US), shown on the diagram; a week in Self-Consumption and in Emergency Backup trips none (#156).
- Direct Connect 1407 serves the gateway's TOU schedule (start times and tariff tiers, workday and weekend alike), so a client reading TOU over Direct Connect sees the schedule the page shows; it answered "not supported" (#132).
- Page: pick the detail card's gateway from a drop-down, filtered by country, state/province, postcode or timezone; Group by gains timezone (#142).
- Events per gateway: what it did on its own (mode, reserve and battery status, full or at reserve, grid lost and back, alarms, derating, breaker, FORCE, export over the limit, listeners, reboots, clients connecting, leaving or refused), in its local time; a panel on the detail card,
GET /gateways/<id>/events,events:level and file (#140). - Monitor: each gateway's Modbus TCP and Direct Connect clients (address, time connected, requests) and refusals in the last hour, plus the process's CPU, memory, threads, tasks and event-loop lag; a page panel and
GET /monitor(#141). - Page: a Docs link in the header and "?" links from each actions group, the TOU schedule and other panels to their docs sections; a test checks every target exists.
- Grid operator rules (
utility:, alsodnsp:orlines_company:): export allowed, limited or prohibited, an import limit, no battery export; enforced as PCS settings. A main breaker (service:) holds import below its rating and trips on overload until reset. Actionsutility,service; card tags (#123). - Page: a °C / °F toggle; every shown temperature converts; °F by default for US-region browsers; the emulator stays metric (#119).
- Docs: a Model baseline page: the hardware against FranklinWH's published models, warranties and compatibility; a diagram of how location, weather, placement, controls and the grid drive the site model; each influence with its default and source.
- Battery temperature limits: charging tapers off in the cold, charge and discharge derate when hot, a heater and fan draw power, and OVER_TEMP is raised and cleared automatically; on with
install:orbattery_temperature; card tag "derated: cold/hot" (#111). - Installation placement (
install:indoor heated/unheated/uninsulated, or outdoor with its sun and cover) drives the cabinet temperature: it follows its surroundings with a lag and warms with battery power; ModbusTmpCaband the UI follow (#110). - PV output falls as the panels heat up (NOCT cell temperature, −0.4 %/°C relative to a typical 45 °C cell, so calibrated outputs are kept);
pv_temperatureper gateway,falseturns it off; state and diagram show the cell temperature and its effect (#109).
Changed¶
- AU aGates have smart circuits 1–2 (AU system datasheet; the reference aGate's 1412 meters SW1 and SW2 only, fwh-local capture, V12R02B30D06): circuit 3 and loads bound to it are refused on AU models, 1410 still sends the inert, default-populated Sw3 slot as the aGate does, and 1412 meters SW2 from circuit 2 (it read 0). North American models keep 1–3, with circuit 3 as the car switch. The
sydney-familypreset's aircon is no longer on a circuit (#189). - Repo follows the shared issue policy: a PR template (Refs #N, evidence, break check, verification), an Issues and PRs section in CLAUDE.md (labels, Triage log, release and .dev steps), and Unreleased in the CHANGELOG uses each Keep a Changelog heading once, checked by a test (#136).
- Version 0.2.2.dev0: between releases main reports the next version's .dev, so a build after a tag no longer reports the tag;
GET /versionadds the commit in a checkout. A test fails if CHANGELOG has unreleased entries on a plain version. M1Optholds 16 characters, so it reads "Emulator 0.2.2.d" (#163). - Energy diagram redrawn to the owner's design (Battery Flow Diagram, boards A and B): the design's icons for grid, meter, panel, home, PV, aGate, generator, switches and loads; one line per phase; a card per aPower with an SoC ring; generator and SW 1–3 tiles with their loads; the aGate's dot shows its health. Header: site name in bold, place and local time, the weather line, state and solar tags, and the hardware summary top right (#205).
- North American models default to no battery export (ESS Import-Only Mode, factory preset per the FranklinWH PCS Technical Brief): the battery serves the home only unless
utility.battery_export: true. AU/NZ models are unchanged. US gateways in existing fleets (60 Hz or country US/CA) behave differently (#180). - The Direct Connect front end imports the client library by its current name,
franklinwh_direct_connect_api, and needsfranklinwh-direct-connect-api>=0.4.0; the oldfranklinwh_localname is removed in 0.6.0, which would have stopped the emulator from starting (#133). - The default firmware profile is now
agate-v12r02b60d00-candidate, matching the reference aGate since its 2026-10-20 update: the 40000 mirror, 15509 = TOU reserve, 16001 = the active reserve, charge setpoints refused with exception 3, IBG V12R02B60D00 over Direct Connect. Setprofile: agate-v10r01b04d00for the earlier behaviour (#126).
Fixed¶
- Docs: aPower S MPPT reporting now cites the cloud API's fields (runtimeData mpptAllPower/mpptActPower/mPanPv1Power/mPanPv2Power, solarHaveVo mpptEnFlag/mpptExportEn, mpptWhArray) instead of calling it unknown.
- Direct Connect 1702:
gridImportLimitonly on V12R02B60D00 profiles (absent on V12R02B30D06, as captured), andratedGridHzreads 1. - Page: a forced solar value is "capped by the sun" only down to
solar_available_w; curtailment below that gets its own tag and diagram note with the cause (off-grid with nowhere to put it, the full-battery 62.2 Hz cut-off, or an export limit/grid support). State addspv_cutoff(#176). - Stopping a gateway cancels a running episode, reboot or Modbus on/off change instead of leaving its task pending ("Task was destroyed but it is pending!") (#21).
- Single phase (
ac_type: 0) with a North American grid code (120 V line-to-neutral) is refused with the fix (ac_type: 1); it served 60 V half-legs. Thecommissionedkey says in-service gateways share the reference sno unless each sets its own. The control API and UI stay on loopback: they are unauthenticated (#153). - Docs: Direct Connect error rules say what the listener does: odd request codes 1101–1997 get
reason:4, even (reply) codes get no reply, other odd codes close; a read missingid/datekeeps its keys, empty;mainRelay2Status(genset relay) is present on single phase too (#152). - Docs: the Control API page's
ctlandcurlexamples useagate, the gatewayservestarts (--id), and say to usesitewith examples/fleet.yaml; they failed withserve(#165). - Docs: README and Getting started clone the repo first and create the venv with
python3(3.10 or later);python3.12failed on Debian 12 (#164). - The V12 profile serves the values read on V12R02B60D00 (franklinwh-modbus SUNSPEC_SNAPSHOT of 2026-10-20, one site): M1
Mn"FranklinWH", 15018 = 15019 = 5000, 15500 PVUse 1 and 15501 0; it served the V10 dump's (#161). validate(andui) report two gateways that set the sameseedorserial: they get the same Modbus serial, so serial-keyed clients would collide. Gateways that set neither still share seed 0 and are not refused (#162).- Page: form results and Activity show the gateway's local time, as its card and Events do (they showed the browser's zone and UTC); actions from the page are logged with source
page(they readapi); no favicon request, so no console 404 (#167). - Direct Connect 1405: a full-block write applies
BBBackupSoc(the eight min/max fields stay 0), as franklinwh-direct-connect-api's catalogue records (proven 2026-09-14); it was acknowledged and discarded (#171). - Docs: BRIDGE_INTEGRATION check 2 expects the default profile's exception-3 refusal of Force Charge (−5 kW needs
agate-v10r01b04d00); DIRECT_CONNECT, DESIGN and the profiles docstring nameagate-v12r02b60d00-candidateand V12R02B60D00_260924 as the default (#166). - Generator:
startDelTimeis the app's Alarm delay after starting fails (FranklinWH PCS Technical Brief): auto start no longer waits it out, and a failing start raises the fail-to-start fault after it. Aliasstart_fail_alarm_s; theoffgrid-generator-agsscenario follows (#179). - Direct Connect faults act as on Modbus TCP:
session_heldrefuses the next client,reset_aftercloses after N requests,slow_p/slow_msdelay replies;range_fault(register ranges) is refused ondc-faultsinstead of being stored and ignored (#170). - Direct Connect 1707
gridLineVolon three phase is the line-to-line voltage (√3 × line-to-neutral, about 419 V on AU and 208 V on US supplies), as the key's meaning and split phase already did; currents unchanged (#151). - Direct Connect: an opt-in client limit (
quirks: {dc_max_connections: 1}) refuses extra clients as Modbus TCP does; the default stays unlimited because the aGate's :9000 limit is unmeasured. The banner, coverage table and docs no longer imply a one-client limit on :9000 (#150). - V12 profile: extension reads 15517–15599 return 0, not exception 2, as swept on V12R02B60D00; V10 still ends at 15516 (#160).
- V12 profile: M704 reversion is inverted as measured on V12R02B60D00: a
WSetRvrtTmswrite starts the countdown, the reversion value (WSetPctRvrt/WSetRvrt) applies while it runs, the setpoint after;WSetEnastays 1. V10 is unchanged (#159). - Diagram: the Meter box shows the service rating (main breaker amps and kW), the trip progress and "tripped"; "no rating set" without
service(#156). - Monitor: a client that has left is no longer shown as "none"; each listener shows the last client and how many since start, and the header counts all seen (#154).
- Direct Connect 1303 has the same keys on every date: a date with no data now carries
sectionEngy(zeros) instead of leaving it out (#134). - Direct Connect replies echo the request's
opt, as the reference aGate does: 1409 and 1723 writes answeredopt:0(#135). - Emergency Backup now fills the battery to 100 % from the grid as well as solar, at the aPower rating; it charged from surplus solar only, so a site could sit at 71 % for hours (#138).
0.2.1 (2026-10-31)¶
Added¶
- Model 1
OptreadsEmulator <version>so clients can tell an emulated gateway from a real one;Mn,Md,Vrunchanged, serials still start withMOCK(#106). - Docs site (MkDocs Material) with a Web UI guide and screenshots; the README is now a short intro, disclaimer, quick start and docs map (#85).
0.2.0 (2026-10-31)¶
The first tagged release since 0.1.0. One line per change from here on; the detail is in each
PR and its tests/results/ file.
Added¶
- Page: TOU schedule timeline (dispatch and tariff over 24 h) and an editor for its blocks and prices (#61).
- Enable or disable Modbus TCP with a real Direct Connect 1205 write, from the page or the
dc-modbusaction; statemodbus_listening(#64). - Reboot a gateway with a real Direct Connect 1721 write, from the page or the
dc-rebootaction; staterebooting(#69). debug-modeaction: Direct Connect 1301 reportsrun_status8 (Debug Mode) for client testing; not seen on the local channel (#72).apoweraction: switch an aPower off or on as its physical switch does; it then adds no power (#73).- V12 candidate profile: a write to the 40000 mirror is answered with the base-0 address, as measured (#77).
- Page: group gateways by location (country, state, city, postcode, site ID), compact cards, local time and timezone on every card;
locationgainscountry,state,city,site_id(#92). - Direct Connect 1102 login: the full reply per aGate firmware, as measured, with per-aPower lists; profile field
dc_firmware(#79).
Changed¶
- Debug Mode is Direct Connect 1821 (
debug-modeaction or a 1821 write): it stops the battery, so the house runs from the grid and 1301run_statusreads 0, as on the reference aGate. It replaces therun_status8 injection (#101). - An M704 setpoint is labelled FORCE · charge / discharge / standby, not "VPP"; during it, Direct Connect 1707 reads programme 9 and 1301's name is empty, as measured on the reference aGate; state
force(#91). - Direct Connect 1102 on the V12 candidate answers
result 1, reason -2with the full manifest, as recorded on the reference aGate (#81).
Fixed¶
- Direct Connect 1102 on the V12 candidate answers
result 0, reason 0again: a live read on the same firmware, to the same request, contradicts the stored record #81 followed (#94). - Page: after a reload, "Actions on" showed the first gateway instead of the active one (#65).
- Session restore read a bare
on:key astrue; it now maps it back, as fleet files do (#67). - Direct Connect 1102 sent
SUNSPEC_FW, a key no aGate is known to send; removed (#75).
TOU schedule with dispatch codes and tariff periods (2026-10-31, #58)¶
- In TOU mode the battery follows a schedule of blocks in the FranklinWH cloud format
(franklinwh-cloud TOU guide):
startHourTime/endHourTime,waveType(0, 1, 2, 4),dispatchId(1 HOME, 2 STANDBY, 3 SOLAR, 6 SELF, 7 GRID_EXPORT, 8 GRID_CHARGE). Gaps are SELF, off-peak.tou_schedule/tou_ratesin the fleet file; thetouaction at run time (doesn't change the mode); statetou(schedule, rates, active block, minutes left). - The default schedule is the previous fixed behaviour (solar-charge off-peak, self-consumption 17:00–21:00), so existing scenarios are unchanged.
- The guide's limit fields are kept and shown, not applied (the guide:
minDischargeSocis ignored by the aGate; the others aren't verified in all firmware). - Page: lists of objects (the schedule) are edited as JSON until the schedule editor lands.
Forced solar can't exceed the sun (2026-10-31, #56)¶
pv solar_wis now a ceiling: solar = min(forced, what the gateway's solar model gives at its local time: open-meteo's value, the synthetic sky or the bell curve), so 0 at night (owner: "no sunshine - no solar").Site.solar_model_w()is the model's value.cap_forced_solar: false(per gateway) uses the forced value as given, for lab tests where PV is an input; the grid-code, CSIP and export-limit tests and theau-response-timing,csip-comms-loss,csip-zero-exportandlatent-export-breachscenarios set it.- The page shows both: "solar forced 16.00 kW, capped at 0.00 kW by the sun".
Weather error says how to add a weather model (2026-10-31)¶
- The weather action on a gateway without a weather model said "site uses the bell curve";
it now says to add
weather: {model: synthetic}to the gateway's fleet entry.
Factory vs in-service energy: totals, commissioning, history (2026-10-31, #53)¶
- A factory aGate starts with lifetime totals at 0 and is commissioned the day it starts
(Direct Connect
sno0). An in-service one keeps the reference aGate's totals and its 2024-07-25 commissioning date. Totals given in the fleet file win either way. commissioned: YYYY-MM-DDsetssno.history_days: N(in-service, ≤ 105) runs the site model over the N days before start-up so the 1303 history, today's 1301 totals and the lifetime counters agree (~0.2 s per day per gateway).Site.backfill().- Example fleet:
sitegets 7 days of history. SiteConfigcounter defaults are nowNone(= the reference values inSite).
Generator: fit a working one from the page (2026-10-31, #51)¶
- The generator action's
installed: truenow fits a working generator, as the fleet file'sgenerator: {installed: true}does (feature on, 7 kW, auto start), for settings still at their factory value. New fieldrated_w(W, 1901genRatedPower) sets its size.
Web UI: active reserve, coloured mode and battery status, firmware (2026-10-30, #49)¶
- Cards show the active reserve under the SoC (the mode's reserve; 100% in Emergency Backup; the off-grid floor while islanded), the firmware, and the battery status as a tag.
- Colours (light and dark shades): Self-Consumption green, TOU cyan, Emergency Backup red; Charging red, Discharging green, Standby orange (off-grid versions too). The diagram's aGate box uses them and shows the reserve.
- State gains
firmware,active_reserve,offgrid_floor_soc.
Action log, Save and Restore (2026-10-30, #47)¶
- The control API logs every action it applies (page,
ctl, API, restore), with wall time, the gateway's local time, the body and the result:GET /log, and the page's Activity panel. - Save (
POST /session/save, the header's Save) writes the successful actions in order, minus events (episode), plus each gateway's SoC, with the emulator version and fleet file, to<workspace>/sessions/<name>.yaml(default./emulator-workspace, gitignored). - Restore (
POST /session/restore, the header's Restore, orui FLEET --restore NAME) replays them and reports each one that fails.GET /sessionslists them; names only.
Web UI: notices a restart or new version (2026-10-30, #45)¶
- The page checks
GET /versionevery 5 s. If the emulator restarted, it says the gateways started fresh (earlier actions not kept), with Reload and Dismiss; if it now runs a new version, it says which and offers Reload.GET /versiongainsstarted.
Appliance form offers the gateway's own appliances (2026-10-30, #43)¶
appliance.nameis a dropdown of the active gateway's appliances, labelled with their smart circuit ("ev · SW2"); "this gateway has no appliances" when it has none (schemaoptions_from: appliances).- Errors name the fix: "this gateway has no appliances: add
loads:to its fleet entry (e.g.loads: sydney-family) and restart"; a wrong name lists the gateway's appliances. (It used to say "site has no load components", where "site" meant the site model, not a gateway.)
Breaking: Direct Connect always on, Modbus TCP off on a factory aGate (2026-10-30, #40)¶
- As on a real aGate (owner, 2026-10-30): every aGate profile runs a Direct Connect listener (a
free port unless
directconnect: {port: N}is given), and Modbus TCP starts off until a Direct Connect1205sunsMdEnwrite enables it (about 3 s later). - New
setup:factory(default; as above) orin-service(already set up: Modbus TCP on).modbus_enabled: true|falseoverrides either.serve --setup. The non-aGatespecprofile is unchanged (Modbus TCP on, Direct Connect only when a port is given). franklinwh-direct-connect-apiis now a standard dependency (was the[dc]extra).- Migrating: code and fleets that expect Modbus TCP from the start add
setup: in-service(the example fleet now sets it underdefaults). - Example fleet: Direct Connect ports 9020–9026 for every aGate, a factory aGate
fresh(Modbus 5026), andloads: sydney-familyonsiteso smart circuits and appliances work. - The UI card says "Modbus TCP off"; start-up output says how to enable it.
Web UI: forced values are marked (2026-10-30, #38)¶
- Solar, load or ambient set through the pv / load / ambient actions replaces the model at any hour (solar at night included). Cards now get an amber "solar forced 6.00 kW" tag, the diagram's PV / Home boxes turn amber and dashed with "forced", and the header says "solar forced to …, not the sun". Sending null hands the value back to the model.
- Control state gains
overrides(solar_w,load_w,ambient_c; null = the model).
Web UI: "Direct Connect off" (2026-10-30, #36)¶
- A card says "Direct Connect off" when its gateway has no
directconnect:entry, rather than showing nothing. In the example fleet onlysiteandus-splithave a listener (docs/UI_TESTING.md says so).
Web UI: version, actions on the right, active gateway pinned (2026-10-30, #34)¶
- The header shows the emulator's version and, from a git checkout, the short commit
(
GET /version, new). - On wide screens the actions sit in their own scrolling column on the right; a header switch puts them back below (remembered in the browser). Narrow screens stack.
- The actions column pins "Actions on [gateway]" at its top, with a picker to change the active gateway.
vpp.wattssays it is used whenpct_hwis also sent.
Web UI: aGate status, day or night, temperatures (2026-10-30, #32)¶
- The aGate box shows the mode, run status with battery kW (Charging, Discharging, Standby and the off-grid versions), SoC, inverter state, cabinet temperature, and "Modbus VPP" (amber) while an M704 dispatch is active.
- The diagram header has a sun or moon icon with the sun's elevation at the gateway's location, the sky in words ("broken cloud", not "broken"), irradiance, and ambient and cabinet temperatures (cabinet is the emulator's model, and says so).
- Remote (cloud) VPP mode and the network connection type join the "not modelled" list.
- Control state gains
run_status_name,inverter_state_nameandsun(elevation_deg,up; null without a location).
Every on/off field says what it does (2026-10-30, #30)¶
offgrid.on: true = island now; false = end the request and reconnect when the grid code allows. The other true/false fields (restore, enforced, flicker, circuit on, installed, modbus, csip, enable, server_up, clear) say what each value does too; the UI shows it.
Mode numbers say which numbering they use (2026-10-30, #28)¶
- The
modeaction andnative_modeuse the Modbus 15507 numbering (1 Emergency Backup, 2 Self-Consumption, 3 TOU). Direct Connect and the cloud number modes differently (1 TOU, 2 Self-Consumption, 3 Emergency Backup). The schema now labels each value and states both; the UI shows "1 · Emergency Backup". - Fixed stale text:
ctlhelp saidmode <1-4>and the fleet example listed4 manual; 15507 = 4 was never read and isn't accepted.ctl statusprints the mode's name.
Web UI testing guide (2026-10-30)¶
docs/UI_TESTING.md: start the UI on the example fleet, then check the cards, the energy diagram and the actions step by step, with what each should show; with a bridge; undoing.
Web UI: actions panel (2026-10-30, #25)¶
- Every control action as a form on the active gateway, built from
GET /schema: fields by type, required ones marked, units and docs shown, "fill from example". Only filled fields are sent; the emulator's answer stays in the form (no toasts). schema.GROUPS: each action's group, served byGET /schema(groups) and set on each action (group).
Web UI: energy diagram (2026-10-30, #22)¶
- The selected gateway's live energy diagram, after the owner's design: grid, meter, aGate, main panel and home, PV per input (aPbox for remote inputs), battery (one combined unit), generator and smart circuits with their appliances. Animated lines follow the power's direction; still with reduced motion. Unmodelled elements are listed, not drawn.
- Control state gains
pv_inputs,apower_unitsandapower_rating(per aPower, the emulator's constants).
Web UI: gateway cards (2026-10-30, #22)¶
franklinwh-emulator ui FLEET.yaml: validates the fleet, starts it, and serves a read-only page with live gateway cards and a detail panel for the selected (active) gateway, plus the control API, on one loopback port (default 8502).Fleet.start(..., ui=True)does the same in-process.- Alpine.js 3.14.1 vendored (identical to upstream and to the Modbus bridge's copy); system fonts; no network.
- Control state gains
native_mode_name; the control server can return pages and files.
Check fleet and scenario files without running them (2026-10-30, #18)¶
validate.py:validate_fleetandvalidate_scenariobuild everything a run would build except the servers, and return every problem as{path, error}: unknown keys, bad values, duplicate gateway ids, port clashes, unknown step actions and body keys, steps aimed at a missing gateway.config_schema()describes every gateway key (type and default fromGatewayConfigandSiteConfig, plus a one-line meaning).GET /schemaserves it asgateway_config.
One schema for the control actions (2026-10-30, #18)¶
schema.pydescribes every control action: fields, types, units, allowed values, signs, required fields and examples.GET /schemaserves it.- Changed: the control API (and scenario steps) now refuse unknown body keys and missing
required ones with 400. They used to be ignored, so
{"hz": 51, "phse": "L2"}changed every leg. - The
control.pydocstring no longer lists the actions; it had drifted (generatoranddc-faultsmissing,mode4 listed but not accepted). README and SCENARIOS.md point to the schema.
UI plan (2026-10-30)¶
docs/UI_PLAN.md: a plan, not yet built, for a local page to configure fleets, run scenarios and steer and watch emulated gateways. YAML stays the file format and JSON the wire format.docs/UI_PLAN.md: the owner's answers (any user; the bridge's look with a live energy diagram, location and weather; first release here with no JavaScript build), the diagram's settings against what the emulator models, and what it doesn't model yet.
Profiles checked against firmware_quirks.json (2026-10-30)¶
tests/test_quirks_drift.py: anagate-*profile may assert only what franklinwh-modbus firmware_quirks.json (pinned v0.11.0) records as documented or measured for its firmware.QUIRK_BASISmaps each firmware-specific setting to its behaviours;QUIRK_ASSUMEDlists the V10 sign assumptions, and the test fails once the file measures them.- V12 candidate: WSetPct limit raw +100 and charge refusal (negative WSet / WSetPct, exception 3)
are now on by default (
m704_wsetpct_accepted_range,m704_wset_negative_refused, measured). New profile fieldrefuse_charge. - V12 candidate: 15016 = 1 while islanded is now opt-in (
quirks: {islanded_15016: 1}); the file grades it reported (ext_15016_status). - The Emergency Backup 16001 = 100 citation is franklinwh-modbus-async #16 G2, not franklinwh-modbus #63.
WSet sign; franklinwh-modbus 0.11.0 (2026-10-29)¶
- M704
WSet(WSetMod = 1) is now positive = discharge in every profile, as measured on V12R02B60D00 (franklinwh-modbus firmware_quirksm704_wset_sign, #104) and as SunSpec defines. It was positive = charge, with no recorded basis. Not measured on V10R01B04D00. - Test dependency pinned to franklinwh-modbus v0.11.0, which sends watts through
WSetwith that sign and ships firmware_quirks.json.
span_unlock removed (2026-10-29, #10)¶
-
There is no SPAN unlock: writes to 15507–15509 are always acknowledged and not applied, as franklinwh-modbus's firmware_quirks.json records (
ext_15507_15509_writes). Removed fromGatewayConfig,AGateDevice,serve --span-unlock, the control-API state, the example fleet and the docs. A config that still passes it fails at load. Set mode and reserves from the test side (Site.set_native_mode,set_reserves, site config, control API). -
History squashed for publication (2026-10-13). Earlier commit hashes cited in issues and results refer to the maintainer's private archive.
WSetPct limit opt-in (2026-10-21)¶
- The v12-candidate profile no longer refuses
|WSetPct raw| > 100: the V12 limit is not concluded. Opt in withquirks={"wsetpct_max_abs_raw": 100}.
Write rejection (2026-10-21)¶
write-reject {model, point, abs_gt|gt|lt, code}(control API,ctl,AGateDevice.reject_writes).- Profile
agate-v12r02b60d00-candidaterefuses|704.WSetPct raw| > 100with exception 3 (owner's test 2026-10-21, discharge side; charge side assumed symmetric, unverified).
V12 reserves (2026-10-21)¶
- Profile
agate-v12r02b60d00-candidate: 15509 is the TOU reserve, and 16001 the active mode's reserve (100 in Emergency Backup). Read with the app in each mode, one site (franklinwh-modbus #63).
V12 addressing (2026-10-21)¶
- Profile
agate-v12r02b60d00-candidateserves the SunSpec map at 0 and 40000 (measured 2026-10-20, one site). Newwrite_basesquirk;addressingcontrol action andctlverb switch the mirror and the write bases at run time.
Slow replies (2026-10-21)¶
- Faults
slow_p/slow_ms: a seeded fraction of Modbus replies is delayed, so a reply can land after the client's timeout on the same socket.
Range faults (2026-10-21)¶
range-fault {start, end, mode, code, for_s}(control API,ctl,Faults.fail_range): an exception, no reply, or a short reply only for requests touching that range, optionally timed.
15507: modes 1–3 only (2026-10-21)¶
- Removed mode 4 (Manual), following franklinwh-modbus #88 (#75): 15507 has only read 1, 2 and 3.
Mode 4 is refused by the control API, site config and Direct Connect; an extension write of 0
or 4 is acknowledged and not applied, even with
span_unlock.
Drop-and-return-islanded episode (2026-10-21)¶
episode {down_s, offgrid_s}(control API,ctl,Gateway.episode): listeners down with RST, back islanded, grid restored. Candidate profileagate-v12r02b60d00-candidate(15016 = 1 while islanded, observed twice on one site).
Direct Connect 1207 and charge calibration (2026-10-08)¶
- The emulator stores Direct Connect 1207 writes with no effect. 222 tests.
- Morning force-charge staircase (1 / 2.5 / 5 kW): charging converter loss ≈ 70 W + 11.6 W/kW² · P², pack resistance ≈ 7 mΩ, SoC scale = SoH-derated 13.03 kWh (docs/CALIBRATION.md).
Modbus reference scan (2026-10-07)¶
- Full read-only scan of the real aGate over Tailscale, with the bridge's poller paused for 42 s
(
tools/agate_scan.py). The emulator's faithful profile now matches all 589 static points (tests/data/reference_scan_static_2026-10-07.json). - Baseline: the real 705–712 curve groups and 704 PFWInj (Australia A codes; unimplemented for
IEEE) and
1.Pad0x8000. Profile flagsm714_port_zero(714.Prt[0] all zero) andthrotpct_unimplemented. - Response timing preset
agate-declared(the 0–0.1 s declared in 705/706/711); named presetsas4777-envelope/ieee1547viagrid_overrides: {response: <name>}. 219 tests.
Generator and AGS¶
generator:per site, with the Direct Connect 1901 fields and the reference aGate's defaults (feature off, AGS 20/80 %, 1800 s start delay).- SoC-based auto start while islanded, after the start delay and inside the operating windows;
stop after the minimum run. Manual mode, the exercise run, crank/warm-up/cooldown, and
loading at
genOptiPPoint; the battery covers anything above rated. It is never paralleled with the grid and hands back when the grid returns. - Faults: fail-to-start, trip, out of fuel.
- Direct Connect: 1902 readable and writable with a full block (
franklinwh_local.set_generator*verifies);p_gen/kwh_gen/genStat/main_sw[1]in 1302;p_genin 1304;genRelayOpenin 1710;genpowerGenin 1412. - Control action and
ctl generator; recordings addgenerator_w/gen_state, and the energy-balance check includes the generator. - Scenario
offgrid-generator-ags. 215 tests.
Grid response timing¶
- Grid-support responses are no longer instant (
gridcodes.ResponseTiming, per grid code): - a dead time (AU 1 s, IEEE 0.2 s), then a first-order lag on the delivered output;
- freq-watt, volt-watt and volt-var settle to 95 % in 10 s (AU), or to 90 % in 5/10/5 s (IEEE open-loop response times);
- soft export limits are met within 15 s;
- over- and under-frequency responses release only after 0.1 Hz of hysteresis (AU);
- after a reconnect, discharge and PV ramp over
es_ramp_s(360 s AU, matching the scanned 703ESRmpTms; 300 s IEEE). - Configure with
grid_overrides: {response: {...}};response: nullrestores instant behaviour. Theexport_limitcheck allows the response envelope. - New scenario
au-response-timing; built-in scenarios and tests updated to let responses settle. 202 tests.
Calibrated against the reference aGate (2026-10-07)¶
- Battery loss model (
battery:per site; presetsagate-measured(default),legacy,ideal). It was fitted on 30 days of real 10 s data: discharge 0.915 and charge 0.971 against 13.6 kWh, and 72 W of overhead while discharging. Replaying real dispatch, SoC MAE is 0.5–0.7 %, against 3.0–5.4 % with the old model. Seedocs/CALIBRATION.md. - Replay
use: battery: follow the recorded battery power, so the recording's dispatches happen. SoC re-anchors to 100 % when the recording reports full (BMS top-of-charge). - Faithful profile:
713.SoCin whole percent (soc_whole_percent) and714.DCWin 100 W steps (quantize_w), as in the real exports. - Direct Connect payloads match a read-only capture of 20 commands on the real device: all 312 top-level keys. Changes:
reason: 0on normal replies (none on 1726);- 1302
electricity_type/ent/pro_loadand aninfi_statuslist, withoutdevNum; - 1304
date,sectionEngyandsnocounted from commissioning; - 1708 without
energyMode, withdspRunstatus, leg currents andgridVol2; - single phase reported as two half-voltage legs in 1704/1708;
- 1706 integer-mV cells on an LFP curve;
- 1202 standard
timezonewith a separateDSTflag, an emptytimezoneStr(the IANA name onspec) and string coordinates; - 1410/1412 extra fields, with
freqas Hz×10; - 1832 without
isOver; - 1904
opt/result/reason. - Tests pin the captured key sets and the new battery model (188 tests).
- Replay
use: dispatchanduse: mode: infer the recording's dispatches (more than 500 W from native for at least 2 min, median setpoint) and replay them as commands, while the native mode runs between them; step the recorded mode and reserves.replay_compareaddsnative/dispatchedscores and the report listsreplay_dispatches. Native battery MAE on the reference site is 53–63 W, down from about 550 W. - Documented the aPower's idle standing draw (about −27 W from AC while idle; cells at 0 A;
converter online), with data provenance and firmware for every dataset
(
docs/CALIBRATION.md). Addedtools/bms_collect.py, the read-only BMS and power-flow collector used to gather it. Filed firmware tracking (modbus-bridge#10, local-bridge#8) and the Local Bridge export mixing in mocks (local-bridge#9). full_snap_soc(98 inagate-measured): the BMS declares full from about 98 %, as in all 30 real arrivals at 100 %. 194 tests.
Added¶
- Replay (
replay.py): recorded solar/load/ambient from the Modbus bridge's metrics CSV export or its SQLite store (read-only), day-aligned (DST-aware) or absolute, looping, gap fallback to the models, and scaling. Battery, grid and SoC stay simulated. Recordings addrec_battery_w/rec_grid_w/rec_soc, and reports areplay_compare(MAE and bias). Helperto_bridge_csvandscenario run --bridge-csv. Round trip verified to MAE 0.9 W. - House load components (
loads.py):base,daily,schedule,cycle,events(seeded per day),hvac(temperature-driven) andev(immediate/offpeak/solar divert, kWh-per-session, stateful). Presetssydney-familyandsmall-flat, with add/remove/set. Smart circuits now live in the site: switching one removes its load (controlcircuit,ctl circuit, Direct Connect1409writes),1410/1708report state, and the new1411meter reports power and energy. Off-grid the aGate sheds smart circuits first; per-circuitsoc_low_cutoff.applianceforce on/off/auto. Recordings addappl_<name>andcircuitN_w. Scenariossydney-family-day,offgrid-circuit-sheddingandev-solar-divert. - YAML loading maps unquoted
on:/off:keys (parsed as booleans by YAML 1.1) back to strings. - Location per gateway:
location: {latitude, longitude, timezone (IANA, DST-aware), postcode}. The wall clock (TOU, load, daily totals, history,1202, naive scenario starts) follows real DST; weather inherits the coordinates;1202reports the gateway's own location (previously hardcoded to Sydney for 50 Hz codes) and its DST flag. CLI--timezone/--lat/--lon/--postcode. State and recordings carrylocal_time,utc_offset_hours,dstandtoday_kwh. Built-in scenarios useAustralia/SydneyandAmerica/Phoenix. Newsydney-dst-endscenario (with a fixed-offset negative control in tests). - Weather (
weather.py):synthetic(sun position + clear-sky on the array plane + seeded cloud edges; skies clear/broken/overcast/storm) andopen-meteo(real 15-minute GTI and temperature, the bridge's GTI→kW formula, mean-preserving cloud-edge flicker capped at clear sky, per-day disk cache, two Sydney days bundled).weathercontrol action,ctl sky. Scenariossydney-real-dayandcloud-edge-export-limit. - Scenarios (
scenario.py,franklinwh-emulator scenario list|show|run): timed steps in the control-API vocabulary,expectchecks with comparison operators, six invariants, CSV and JSON/text reports, and offline (deterministic) and live (scaled clock, servers up) modes. 9 built-ins cover outage during VPP, CSIP zero export and comms loss, the latent export breach, brown-out ride-through, over-frequency, phase loss and US ride-through.docs/SCENARIOS.md. - Control actions
vpp,release,mode,reserve,soc(alsoctl vpp|release|mode|soc). - Site relay event log (open/close, reason, stage, healthy-grid time before reclose).
Fleet(..., clock=)for a shared clock.
Fixed¶
- Integration now lands exactly on the requested time; float accumulation over 0.1 s sub-steps could miss an exact 60 s reconnect boundary.
- Open-Meteo flicker could amplify clear moments in heavily clouded windows (11 kW from 6.6 kWp). It is now bounded by clear sky, with the shaded fraction set per window to keep its mean.
- Direct Connect
1202reported Sydney's coordinates for every 50 Hz gateway; it now reports the gateway's own location. - Recording columns for appliances are
appl_<name>;load_<name>collided withload_wandload_shed_w.
Added (earlier)¶
- Direct Connect frontend (TCP/9000, optional
[dc]extra): 23 cmdTypes rendered from the sameSiteas Modbus. Login, power_flow with daily kWh, quarter-hour energy_history, per-aPower reads, modes (list/set), off-grid (read/write), relays, solar_pv (grid_feed_max),der_comms(sunsMdEn + CSIP-AUS client), time, network switches, and reboot (both ports drop and return). Real-device error semantics.--dc-port,directconnect:in fleet YAML,ctl dc-fault. Docs indocs/DIRECT_CONNECT.md. - CSIP-AUS client model (
csip.py): enable plus registration, LFDI/SFDI per the IEEE 2030.5 algorithm, utility DERControl events with durations, and the DefaultDERControl when no event is active or after 300 s of lost comms.opModExpLimW,opModImpLimW,opModGenLimW,opModLoadLimW,opModConnectandopModEnergizeact on real power flow. Control API/csipandctl csip …. - Export compliance: grid-code export limits are declared and breaches tracked
(
export_over_limit_w,export_breach_s/_wh); enforcement is optional (export_limit_enforced,ctl export-limit enforce). 1205 sunsMdEn:ctl modbus off|oncloses or reopens the Modbus listener after about 3 s.ausgridgrid code: Australia A plus a 10 kW single-phase export limit (5 kW per phase multi-phase, unconfirmed).- Australia A responses, checked against the published distributor summary: storage
frequency-watt with the f_transition (50.75 Hz) and f_stop-ch (49 Hz) breakpoints, charging
volt-watt, and volt-var.
701.Var/VA/PFare now live. - Grid codes
as4777-au-a,ieee1547-cat2andieee1547-cat3: multi-stage trips, sustained over-voltage, enter-service, andgrid_overrides. Model 703 follows the code. - Phases: single (any leg), split, two-phase and three-phase layouts. Per-leg 701 points, phasor L-L voltages, unbalanced load/generation splits, per-leg metering, per-leg utility voltage and availability (phase loss trips), and an unused-leg register option.
- Grid events: black-out, brown-out and swell, frequency excursions, restore with enter-service delay, requested off-grid. Islanded operation: the battery forms the grid, sheds load, curtails PV and goes dark at the floor.
- PV inputs (proximal / remote1 / remote2) with relays, on 15503–15505.
- Alarms: forced
701.Alrmbits (latched or persistent), tripping alarms fault the inverter,715.AlarmResetclears latched ones, and714.PrtAlrmsraw bits. - HTTP control API (stdlib, loopback) and the
ctlsubcommand. - Docs:
docs/DESIGN.md,docs/FINDINGS.md,docs/BRIDGE_INTEGRATION.md.
Initial¶
- Modbus TCP emulator of the aGate:
- the SunSpec chain (1, 701–715, 502) built from pysunspec2 definitions at the reference scan's lengths, extension registers 15000–15513, and the 16000 block;
- the closed-loop site model;
agate-v10r01b04d00andspecquirk profiles;- a hand-rolled asyncio server with fault injection;
- the
Gateway/FleetAPI and theserve/fleetCLI; - serials matching the Direct Connect
SyntheticSite; - acceptance tests with the unmodified
FranklinWHController.