Repository navigation
Description
Goal
Opt-in mechanism to push forty-two-watts telemetry into Sourceful Nova Core so an operator can federate a home / light-commercial site into the Sourceful fleet backend without running a ZAP gateway.
Principle: clean model now, bridge to legacy at the boundary
Nova Core's current wire format has avoidable tech debt (see design notes below). Rather than importing that debt into f42w, we build f42w with a clean, physics-consistent, snake_case, site-convention payload internally, and translate at the MQTT publisher boundary via a single adapter package. When novacore ships the unified schema (separate PR, this issue's sibling), the adapter is deleted in one go.
Scope (PR 1 — this issue)
-
nova:block in config.yaml (enabled, url, gateway_serial, org_id, site_id, key_path, schema_mode="legacy"|"unified") - `internal/nova/` package
- ES256 keypair gen + storage under state dir
- JWT signer (alg=ES256, header device=gw_serial, 10-min exp)
- HTTP client: `POST /gateways/claim`, `POST /devices/provision`, `GET /sites/{site}/devices`
- MQTT publisher (reuses `internal/mqtt`)
- Adapter: clean f42w payload → Nova legacy wire format (battery sign flip, snake_case→PascalCase, pv→solar, ev→ev_port)
- SQLite: `nova_ders(device_id, der_type, der_name, der_id, synced_at)`
- Drain hook: telemetry.Store → Nova publisher
- Provisioning on startup; nightly reconcile loop
- CLI: `forty-two-watts nova-claim`
- Tests + `docs/nova-integration.md`
Deferred to follow-up PRs
PR 2 (f42w): Lua driver upgrades for lifetime energy counters (`total_import_wh`, `total_charge_wh`, etc.), first-class DER entity in state layer, rated_power/capacity metadata.
PR 3 (novacore): Unified schema proposal. Core changes: snake_case field aliases, site-convention battery sign (+W = charging), DER type vocabulary (pv, ev). Backwards-compat: accept both legacy and unified formats for a migration window.
Design notes — why f42w's model > Nova's current
- Battery sign convention. f42w follows IEC 61968 site convention (+W = into site, so charging battery is +W load). Nova currently has − for charging, breaking symmetry with grid/PV.
- Naming. `SoC_nom_fract`, `L1_V`, `heatsink_C` is a hybrid that no industry schema follows. Home Assistant, OpenAPI, IEC all use snake_case.
- Specificity. `freq_hz` > `Hz` (disambiguates switch vs grid frequency). `temp_c` > `heatsink_C` (allows multiple temp sensors).
- Vocabulary. `pv` is IEC 61724 standard; `solar` is marketing. `ev` > `ev_port` (what is a "port"?).
Identity mapping
| Nova | f42w |
|---|---|
| `hardware_id` | f42w `device_id` verbatim (e.g., `ferroamp:ES9234`, `mac:aabbccddeeff`) |
| `der_name` | `{driver_name}-{der_type}` (e.g., `solis-battery`, `solis-pv`) |
| `der_id` | Nova-generated `der-{uuid7}`; stored locally in `nova_ders` for diagnostics |
| Gateway identity | f42w-generated ES256 keypair, claimed via `/gateways/claim` |
Topic
`gateways/{gw_serial}/devices/{hardware_id}/ders/{der_name}/telemetry/json/v1`
Out of scope
- Control-topic subscription (Nova → f42w commands) — future PR
- Removing the adapter (gated on PR 3 landing)
Activity