Skip to content

REST endpoint reference

Developers Guide · REST API and OpenAPI

Generated file

Generated by tools/gen_api_reference.py from the bridge's own OpenAPI schema (create_app().openapi(), bridge version 0.5.5). Do not edit by hand: change the code, then rerun the script. The running bridge serves the same schema at /openapi.json, which is the authority for request and response bodies.

233 operations on 205 paths, grouped by the path segment after /api/. Description is the first paragraph of the handler's docstring, cut at 140 characters. confirm is ticked when the request takes a confirm field or query parameter; see write safety for what it does.

(UI and static)

Method Path confirm Description
GET / Index

admin

Method Path confirm Description
POST /api/admin/backup Create a consistent DB backup; keep the newest 10, prune older.
DELETE /api/admin/backup/{name} Api Admin Backup Delete
GET /api/admin/backup/{name} Api Admin Backup Download
POST /api/admin/backup/{name}/restore yes DESTRUCTIVE — replace the live DB with a backup. Confirm-gated (428).
GET /api/admin/backups Api Admin Backups
GET /api/admin/metrics/export Export power samples over the last hours as CSV or JSON.
GET /api/admin/storage DB disk-usage: total size + SQLite page accounting + per-table rows & span.
POST /api/admin/vacuum Compact the DB file (reclaim freed pages).

apower-specs

Method Path confirm Description
GET /api/apower-specs aPower model spec table (usable/rated kWh, kW) + the selected gateway's aPower COUNT, so the UI can derive battery capacity = usable_kwh...

battery

Method Path confirm Description
GET /api/battery Full BMS view for one aPower in a SINGLE aGate session.
GET /api/battery/command Api Battery Command State
POST /api/battery/command Store a control value, or (on the battery_command slug) execute it. Executing actually moves the battery, so it is gated on allow_write...
POST /api/battery/record Start a recording session. 409 if one is already running, 422 on bad parameters, 503 if metrics storage is disabled.
GET /api/battery/record/status Progress of the running (or last) session: captured / planned / errors.
POST /api/battery/record/stop Finish the running session early. Safe to call when none is active.
GET /api/battery/sessions Recorded sessions, newest first, with real sample counts and spans.
DELETE /api/battery/sessions/{session_id} Api Bms Session Delete
GET /api/battery/sessions/{session_id} One session with every snapshot, cell arrays parsed to lists.

billing

Method Path confirm Description
POST /api/billing/close Manually close the CURRENT billing period now — snapshots its itemised breakdown into history immediately (rather than waiting for the cy...
GET /api/billing/history Closed billing periods (newest first), or a CSV export with ?fmt=csv.
POST /api/billing/import Backfill closed billing periods from a Modbus bridge /api/tariff/history payload (same physical aGate). Idempotent — re-importing rep...
POST /api/billing/import-modbus One-click: log in to a Modbus bridge, pull its closed periods, and import them. dry_run previews (fetch + count, no write). Idempoten...
GET /api/billing/overview Live period-to-date billing for the gateway's meter's tariff: the running energy/demand/bonus/export-charge/fixed points + the retailer/t...

call

Method Path confirm Description
POST /api/call/{cmd} Issue any request cmdType with a dataArea of {opt, **data}. opt != 0 is a write and requires allow_writes.

capabilities

Method Path confirm Description
GET /api/capabilities What this bridge can actually do right now, and why not where it cannot.

catalog

Method Path confirm Description
GET /api/catalog What each /api/cmd/ endpoint IS: name -> {description, cmd, write} from franklinwh_direct_connect_api.catalog. write ma...

circuits

Method Path confirm Description
GET /api/circuits Smart circuits: config (1409) + metering (1411) + presence detection.
GET /api/circuits/meter Raw 1411 metering for the Monitoring sub-view — one read, no config.
GET /api/circuits/raw Raw 1409 payload — the Smart Circuits counterpart to /api/generator/raw.
POST /api/circuits/{circuit}/power Turn one circuit on/off — 1409 full-block RMW with read-back verification.
PUT /api/circuits/{circuit}/schedule Attempt a circuit schedule write — 1409 full-block RMW, read-back verified.

cloud

Method Path confirm Description
GET /api/cloud/device-info Cloud get_device_info passthrough from local device_info (1116).
POST /api/cloud/grid-status yes Cloud set_grid_status. Parses status against the cloud GridStatus names/values (NORMAL=0 / DOWN=1 / OFF=2); ``on = status != NORM...
GET /api/cloud/mode Cloud get_mode flat dict from local power_flow + mode_list (+ mode_soc, tou_schedule) in one aGate session. Active mode by default; `...
GET /api/cloud/network Cloud get_network_info shape (currentNetType/wifi/eth0/eth1/operator/ awsStatus) from local network_interfaces (1118).
GET /api/cloud/pop CloudFront PoP edge drill-down for the FleetView/Cloud API path — current PoP, PoP distribution, edge transitions, cache-hit rate — aggre...
GET /api/cloud/power-info Cloud get_power_info (raw 211) shape from local relay_status (1710).
POST /api/cloud/reserve Set a mode's reserve SoC via the CLOUD provider (HYBRID Phase 3) — the local API silently discards this write (reserve is cloud-owned), s...
GET /api/cloud/reserves Cloud get_all_mode_soc shape: list of per-mode reserve dicts (workMode/name/soc/minSoc/maxSoc/editSocFlag/active) from local mode_lis...
GET /api/cloud/runtime Cloud get_runtime_data shape from local ibg_run_status (1708).
POST /api/cloud/set-mode yes Cloud set_mode. Maps requestedOperatingMode (cloud workMode 1=Time-of-Use / 2=Self-Consumption / 3=Emergency Backup, or a name/alias)...
POST /api/cloud/smart-circuit/state Cloud set_smart_circuit_state → local 1409 full-block read-modify-write. Read-back self-verified: ok is True only when the re-rea...
GET /api/cloud/smart-circuits Cloud get_smart_circuits shape: {"1": {...}, "2": {...}, "3": {...}}.
GET /api/cloud/smart-circuits/info Raw local smart_circuits payload — mirrors cloud get_smart_circuits_info.
GET /api/cloud/stats Cloud Stats shape ({current, totals, is_stale}) from local power_flow (+ smart_circuits for switch states) in one aGate session. 502...
GET /api/cloud/tou Cloud get_gateway_tou_list envelope ({code, message, result}) from local mode_list (1726, → result.currendId + result.list) enriched...
POST /api/cloud/validate Check the stored cloud credentials with ONE login + a permissioned read.

cmd

Method Path confirm Description
GET /api/cmd/agate_serial Read agate_serial (live)
GET /api/cmd/battery_cells Read battery_cells (live)
GET /api/cmd/battery_inhibit Read battery_inhibit (live)
GET /api/cmd/battery_modules Read battery_modules (live)
GET /api/cmd/cloud_config Read cloud_config (live)
GET /api/cmd/connectivity Read connectivity (live)
GET /api/cmd/der_comms Read der_comms (live)
GET /api/cmd/device_check Read device_check (live)
GET /api/cmd/device_firmware Read device_firmware (live)
GET /api/cmd/device_info Read device_info (live)
GET /api/cmd/device_states Read device_states (live)
GET /api/cmd/energy_history Read energy_history (live)
GET /api/cmd/event_block Read event_block (live)
GET /api/cmd/firmware Read firmware (live)
GET /api/cmd/generator Read generator (live)
GET /api/cmd/grid_policy Read grid_policy (live)
GET /api/cmd/grid_profile Read grid_profile (live)
GET /api/cmd/ibg_run_status Read ibg_run_status (live)
GET /api/cmd/ibg_state Read ibg_state (live)
GET /api/cmd/install_profile Read install_profile (live)
GET /api/cmd/mode_config Read mode_config (live)
GET /api/cmd/mode_list Read mode_list (live)
GET /api/cmd/mode_soc Read mode_soc (live)
GET /api/cmd/network_interfaces Read network_interfaces (live)
GET /api/cmd/network_switches Read network_switches (live)
GET /api/cmd/offgrid Read offgrid (live)
GET /api/cmd/power_electronics Read power_electronics (live)
GET /api/cmd/power_flow Read power_flow (live)
GET /api/cmd/relay_status Read relay_status (live)
GET /api/cmd/smart_circuit_meter Read smart_circuit_meter (live)
GET /api/cmd/smart_circuits Read smart_circuits (live)
GET /api/cmd/solar_pv Read solar_pv (live)
GET /api/cmd/time_location Read time_location (live)
GET /api/cmd/tou_schedule Read tou_schedule (live)
GET /api/cmd/wifi_config Read wifi_config (live)
GET /api/cmd/wifi_scan Read wifi_scan (live)

constants

Method Path confirm Description
GET /api/constants User-defined automation constants + their [min,max] bounds (const.* sensors).
PUT /api/constants Update automation constants (only sent fields; each clamped to its bounds).
GET /api/constants/modes Operating-mode options for the Default-Mode picker, DERIVED from what this aGate actually reports (mode_list). Falls back to the full cat...

control-log

Method Path confirm Description
GET /api/control-log The control audit trail — consequential actions (off-grid / reconnect / reboot / mode / Modbus toggle), newest first. Read-only; empty li...

der-comms

Method Path confirm Description
GET /api/der-comms Api Der Comms
POST /api/der-comms yes Write DER comms toggles (SunSpec Modbus / IEEE 2030.5). Delayed-apply — the device reply is not proof; verify at the interface level (:50...

device

Method Path confirm Description
GET /api/device/model Gateway model/SKU/region from SyHdVersion in the login manifest.

diagnostics

Method Path confirm Description
GET /api/diagnostics/link Reachability and load (#123): per gateway (or the one named), a timed ping and a timed TCP connect to :9000, and how many TCP connections...

disclaimer

Method Path confirm Description
GET /api/disclaimer Text + links for the first-connection legal-disclaimer modal (unofficial app). agreed reflects the DB record for this client_id (auth...
POST /api/disclaimer/ack Record that a user AGREED to the disclaimer: persist to the DB (source of truth for don't-show-again) and write an agreement line to the...

dispatch

Method Path confirm Description
POST /api/dispatch HYBRID-CAPABILITIES Phase 2 — battery dispatch (force charge/discharge/standby/ release, target-SoC) via the resolved Modbus provider. Th...

energy

Method Path confirm Description
GET /api/energy/flow Directional energy flows (the Sankey's data) for a local day or an explicit span. Flows are RECONSTRUCTED from the bridge's power samples...

firmware

Method Path confirm Description
GET /api/firmware Api Firmware
GET /api/firmware/all Gateway firmware PLUS per-battery firmware and serials.

gateways

Method Path confirm Description
GET /api/gateways Roster: one row per gateway. DB-backed (includes disabled rows) when the metrics store is present, else the registered-gateway view. Neve...
POST /api/gateways Api Gateway Create
POST /api/gateways/scan Sweep a subnet for aGates on TCP 9000 and confirm each with a real Local-API login (1101/1102). Returns candidates; the UI adds the confi...
GET /api/gateways/scan/default What Discover will sweep if you do not change it, and WHERE that came from.
DELETE /api/gateways/{gw_id} Api Gateway Delete
PATCH /api/gateways/{gw_id} Api Gateway Update
POST /api/gateways/{gw_id}/restart Reconnect one gateway's poller (and its mock emulator) — applies any changed host/port/poll settings that only take effect on reconnect.
GET /api/gateways/{gw_id}/summary One gateway's full summary — the poller's cached last-good copy when warm, else an on-demand read of that gateway's host. 404 for an unkn...

generator

Method Path confirm Description
GET /api/generator Generator config + run state (1901).
PUT /api/generator/enable Turn the generator feature on/off (genEn).
PUT /api/generator/exercise Set the generator maintenance/exercise run.
POST /api/generator/mode Set generator mode (auto/manual) — 1901 full-block RMW, read-back verified.
GET /api/generator/raw Raw 1901 payload, including fields the view-model deliberately omits.
PUT /api/generator/soc Set generator auto start/stop SoC thresholds.
PUT /api/generator/window/{window} Set one of the three generator operating windows.

grid

Method Path confirm Description
GET /api/grid Grid & Inverter profile (read-only): grid connection + import/export power-plane limits from install_profile (1701), and the inverter's r...
POST /api/grid/limits yes Write the 1701 grid import/export power-plane limits (the FWHAI PCS modal) by full-block read-modify-write with a self-verifying read-bac...

guide

Method Path confirm Description
GET /api/guide Whether the guide is bundled in this build, and where to read it if not.

ha

Method Path confirm Description
GET /api/ha/dashboard-yaml A copy-paste Home Assistant dashboard card for the entities we publish.
GET /api/ha/entities Browse entities across the configured instances, with the same filters the Modbus Bridge's HA Entities tab offers: instance, domain, comm...
POST /api/ha/entities/expose Mark one entity visible/exposed (the checkbox in the browser).
GET /api/ha/instances Configured HA instances. Tokens are never returned — only whether set.
POST /api/ha/instances Api Ha Instance Create
DELETE /api/ha/instances/{ha_id} Api Ha Instance Delete
PATCH /api/ha/instances/{ha_id} Api Ha Instance Update
GET /api/ha/notify-devices Named notification targets, each independently enabled.
POST /api/ha/notify-devices Api Notify Device Create
POST /api/ha/notify-devices/broadcast Send one notification to many devices — all enabled devices, or an explicit device_ids list. Sending is not a device write, so (like the...
POST /api/ha/notify-devices/test Send a test notification — to a saved device, or to an unsaved instance+service so it can be confirmed BEFORE saving.
DELETE /api/ha/notify-devices/{dev_id} Api Notify Device Delete
PATCH /api/ha/notify-devices/{dev_id} Also the per-device on/off — disabling must not require deleting, or a week's pause costs the configuration.
GET /api/ha/notify-targets notify.* services, optionally for ONE instance — these are services, not entities, so they never appear in an entity list.
GET /api/ha/published What THIS bridge publishes to HA, so the two directions are not confused.
POST /api/ha/test Probe a connection. Returns the outcome rather than raising.

health

Method Path confirm Description
GET /api/health Api Health
GET /api/health/link The link's HISTORY, not another probe of this instant (RUNTIME_DESIGN §6.9).
GET /api/health/link/hourly Hourly rollup per gateway and leg — the before/after measurement.
GET /api/health/workers Every DECLARED background worker: state, liveness, restart safety (BR-38).
POST /api/health/workers/{name}/restart Restart one worker, if that is safe right now (BR-37, design §5.4).

host

Method Path confirm Description
GET /api/host/timezone The INTEGRATION-HOST timezone (the bridge process's own zone: TZ env / /etc/localtime). Used for the bridge's system-of-record — audit tr...

integrations

Method Path confirm Description
GET /api/integrations The Integration Mapping page: protocols, saved mappings, and probe targets.
PUT /api/integrations Save the mappings. Refuses a protocol that is not implemented, so a visible placeholder can never become a stored configuration that fail...

live

Method Path confirm Description
GET /api/live Liveness probe for the container HEALTHCHECK / HA watchdog. Confirms the web app is serving — deliberately does NO device I/O, so an unre...

logs

Method Path confirm Description
GET /api/logs Bridge log lines, NEWEST-FIRST, from the durable SQLite store (falls back to the in-memory ring when the store is disabled). Supports off...

meters

Method Path confirm Description
GET /api/meters Api Meters
POST /api/meters Api Meter Create
DELETE /api/meters/{mid} Api Meter Delete
PATCH /api/meters/{mid} Api Meter Update

metrics

Method Path confirm Description
GET /api/metrics Time-series power history from the bridge's own SQLite store. Never 500s — returns an empty series when metrics are disabled or the DB is...
GET /api/metrics/info Api Metrics Info

modbus

Method Path confirm Description
GET /api/modbus Modbus (SunSpec 502) master switch + why it is / isn't usable. Live port-502 reachability is already in the dashboard summary (``modbus_5...
PUT /api/modbus Enable/disable the direct-Modbus path (ratings + force dispatch). Persisted.
POST /api/modbus/test Live connect to the resolved Modbus target and report reachability + ratings.

mode

Method Path confirm Description
POST /api/mode yes Api Set Mode

mqtt

Method Path confirm Description
GET /api/mqtt/config Api Mqtt Config
GET /api/mqtt/conflicts Scan the shared broker for OTHER FranklinWH producers (a Modbus bridge, FWHAI, or a second Local bridge). On a shared broker each produce...
GET /api/mqtt/discover Ask the HA Supervisor for the Mosquitto broker's host/port/creds. In add-on mode creds are auto-applied at startup; this powers a Setting...
GET /api/mqtt/entities Entities for the SELECTED gateway (multi-gateway; mocks included). Values come from that gateway's last poll (so a mock shows its synthet...
GET /api/mqtt/groups The publish-group catalogue + which are enabled (opt-in optional data).
PUT /api/mqtt/groups Set enabled groups; triggers a re-publish on every gateway so HA reflects it.
GET /api/mqtt/orphans DRY RUN — what a purge would clear, and what it would leave alone.
POST /api/mqtt/orphans/purge yes Clear this bridge's orphaned discovery configs. Destructive and audited.
POST /api/mqtt/republish Publish this gateway to Home Assistant (again). If it was unpublished, turn publishing back ON for it (saved), so it stays published acro...
GET /api/mqtt/supervisor Is a broker available from the Supervisor, and is publishing already on?
POST /api/mqtt/supervisor/enable Adopt the Supervisor's broker and turn publishing ON. Explicit, never automatic.
POST /api/mqtt/unpublish Remove THIS gateway from Home Assistant and keep it removed (#119).

network

Method Path confirm Description
GET /api/network Consolidated on-LAN network diagnostics for the selected aGate — the local answer to the Cloud CLI's network view, plus reachability the...
GET /api/network/ping Latency test: N sendMqtt round-trips to the aGate in one session. Returns per-sample ms + min/avg/max + loss%. The on-LAN equivalent of a...

notify

Method Path confirm Description
GET /api/notify/log Api Notify Log
POST /api/notify/test Send a test persistent notification through the configured HA target so the user can verify notifications end-to-end. Informational — not...
GET /api/notify/triggers The configurable auto-notification triggers + per-event delivery stats.
PUT /api/notify/triggers Api Notify Triggers Put
POST /api/notify/triggers/test Fire a test notification through the engine (delivered + logged like a real one).

offgrid

Method Path confirm Description
POST /api/offgrid yes Api Set Offgrid

power

Method Path confirm Description
GET /api/power Api Power

probe

Method Path confirm Description
POST /api/probe Read one field from the device NOW, and show the request that fetched it.

providers

Method Path confirm Description
GET /api/providers Hybrid capability report (HYBRID-CAPABILITIES Phase 1): which local hard walls (battery dispatch, reserve/cloud writes) are fillable, and...

raw

Method Path confirm Description
POST /api/raw yes Send one arbitrary cmdType and return the request + raw response verbatim.
GET /api/raw/catalog Known cmdTypes for the console's autocomplete: code, name, description.

reboot

Method Path confirm Description
POST /api/reboot yes DESTRUCTIVE — reboot the aGate. Double-gated (allow_writes + confirm=true). The gateway drops the connection while it restarts and may tr...

schedules

Method Path confirm Description
GET /api/schedules Schedules plus the action catalogue — including what is NOT available and why, so the UI never offers a control that does nothing.
POST /api/schedules Api Schedule Create
POST /api/schedules/evaluate Evaluate an UNSAVED condition tree against live values — the editor's Test Verification. Returns per-leaf pass/fail (result + `live_val...
GET /api/schedules/export Portable JSON bundle of schedules. ids = comma-separated (default all). fmt=automations emits the Modbus bridge's ``franklinwh-au...
POST /api/schedules/import Validate a bundle; with dry_run=false create the valid entries DISABLED for review. An unknown gateway falls back to the default, and...
GET /api/schedules/log Recent schedule events, newest first — the history view.
GET /api/schedules/presets Built-in schedule templates for the Load Preset dialog. Every action is one the local channel can actually do — no force-charge preset.
GET /api/schedules/runs The execution queue itself — what ran, what is pending, what was missed.
GET /api/schedules/stats Per-rule execution history: runs, first, last, last failure.
GET /api/schedules/timeline Today's timeline: each enabled schedule's planned window, plus the real work-mode band, the SoC % line, and fire markers from the activit...
DELETE /api/schedules/{sid} Api Schedule Delete
PUT /api/schedules/{sid} Api Schedule Update
POST /api/schedules/{sid}/pause Release control but KEEP this run, so Resume can re-enter it.
POST /api/schedules/{sid}/resume Re-enter a paused run — only while its window is still open.
POST /api/schedules/{sid}/run Run a schedule's actions NOW, ignoring its window. Still honours the write gate — this performs real actions.
POST /api/schedules/{sid}/stop Release just THIS schedule's running battery dispatch (leaves it enabled), vs the global topbar Release. No-op with a clear message if it...
POST /api/schedules/{sid}/test Evaluate the conditions against live values WITHOUT firing anything — the 'Test verification' the user asked for.

schema

Method Path confirm Description
GET /api/schema Reverse index raw_key -> {label, group, unit} (ported field schema). Used by the Device tab and Live Points to label/group raw device...

settings

Method Path confirm Description
GET /api/settings Api Settings
PUT /api/settings Live-apply a small whitelist of runtime settings (allow_writes / log_level / ha_notify) and persist them to DATA_DIR so they survive a re...

setup

Method Path confirm Description
GET /api/setup Where setup stands — every step, whether it is already satisfied, and whether to prompt. Safe to call repeatedly; re-running the wizard i...
GET /api/setup/capabilities Which capability-gated tabs apply to this SITE. Not a permissions answer.
POST /api/setup/cloud Check FranklinWH app credentials by SIGNING IN, and store them only if that works.
POST /api/setup/expected Record how many aGates and aPowers the owner says they have. Both default to 1.
GET /api/setup/ha-checks The four things that decide whether this bridge shows up in Home Assistant.
POST /api/setup/state Record that the wizard was completed or declined. Never blocks anything — 'skipped' only stops the prompt, it does not disable a feature.
GET /api/setup/timezone The site timezone, and what each gateway's own clock reports.
POST /api/setup/timezone Set the site timezone — ONE zone for the whole site.

site

Method Path confirm Description
GET /api/site/status Whole-site aggregation across every registered gateway, from their poller caches (no device I/O). Never 500s — cold caches contribute zer...
GET /api/site/timezone The SITE's timezone from the aGate (1201), so charts show aGate-local time — not the browser's (which may be in a different country). The...

sites

Method Path confirm Description
GET /api/sites Api Sites
POST /api/sites Api Site Create
DELETE /api/sites/{sid} Api Site Delete
PATCH /api/sites/{sid} Api Site Update

solar

Method Path confirm Description
GET /api/solar All things solar: PV inputs, remote solar/aPbox, relays, export limit.
GET /api/solar/forecast Weather + PV production forecast from Open-Meteo, scaled to the configured PV array. Needs latitude/longitude set in Settings; otherwise...
GET /api/solar/raw Raw 1903 payload.
POST /api/solar/sync-location Read the aGate's OWN configured location (cmd 1201 time_location) and save it as the solar-forecast location — no cloud needed. NB the fi...

summary

Method Path confirm Description
GET /api/summary Api Summary

support-info

Method Path confirm Description
GET /api/support-info A REDACTED diagnostic bundle to paste into a GitHub issue — models, firmware, counts, modes and settings, with NO serials, hosts, IPs, lo...

system-setup

Method Path confirm Description
GET /api/system-setup Per-gateway System Setup: resolved values (default → derived → override) + spec.
PUT /api/system-setup Set user overrides (null reverts a field to the derived value). No device write.

tariff

Method Path confirm Description
GET /api/tariff/spot Live dynamic-tariff price — the two providers in one view (see FEAT-BILLING-WHOLESALE): the AusNEM built-in (AEMO NEM regional spot, c/kW...

tariffs

Method Path confirm Description
GET /api/tariffs Api Tariffs
POST /api/tariffs Api Tariff Create
POST /api/tariffs/import Import a Modbus franklinwh-bridge/tariff-profile — creates the utility + tariff and attaches them to the default meter (with the prof...
POST /api/tariffs/validate Check a rate model's coverage/tier completeness — the editor's live linter.
DELETE /api/tariffs/{tid} Api Tariff Delete
PATCH /api/tariffs/{tid} Api Tariff Update
GET /api/tariffs/{tid}/export Export one tariff (+ its utility + the meter's timezone) as a Modbus-compatible franklinwh-bridge/tariff-profile bundle — the exact s...

utilities

Method Path confirm Description
GET /api/utilities Api Utilities
POST /api/utilities Api Utility Create
DELETE /api/utilities/{uid} Api Utility Delete
PATCH /api/utilities/{uid} Api Utility Update

version

Method Path confirm Description
GET /api/version Version + asset token, so an open tab can notice a rebuild and offer a reload.