docs: record the verified register map and inverter IDs
P06D is a latched 21450 (not power), P052/P05A static, P063 frozen; power is computed V*I. Lists what's sent, what isn't, the unmapped diagnostics, the INV1-INV5 IP assignments, and that timestamps must be real UTC. The simulator now sends the same payload shape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -88,13 +88,29 @@ the chart picker without further changes.
|
|||||||
datalogger is still posting and the sun is up. At night that's **Sleeping**;
|
datalogger is still posting and the sun is up. At night that's **Sleeping**;
|
||||||
if the datalogger itself is silent the state is **No data** (and a banner
|
if the datalogger itself is silent the state is **No data** (and a banner
|
||||||
says so).
|
says so).
|
||||||
- **Fault** — the reading carries a non-zero `error_code`.
|
- **Fault** — the reading carries a non-zero `error_code`. No `error_code`
|
||||||
|
(the poller doesn't send one yet) means no fault.
|
||||||
|
- **Feeding / Standby** — online and `status_code` is in
|
||||||
|
`FEEDING_STATUS_CODES` (7, 8) → Feeding; any other code → Standby. An
|
||||||
|
inverter in standby while its peers produce is caught by the
|
||||||
|
underperformance check below.
|
||||||
- **Check needed** — output below `UNDERPERFORM_RATIO` (75%) of the fleet
|
- **Check needed** — output below `UNDERPERFORM_RATIO` (75%) of the fleet
|
||||||
median over the last 10 min (per kWp once every inverter has its array size
|
median over the last 10 min (per kWp once every inverter has its array size
|
||||||
set), or one MPPT input below half of the other.
|
set), or one MPPT input below half of the other.
|
||||||
|
|
||||||
Thresholds are in `.env`.
|
Thresholds are in `.env`.
|
||||||
|
|
||||||
|
### Energy
|
||||||
|
|
||||||
|
Daily energy uses, in order: the inverter's daily counter
|
||||||
|
(`daily_energy_wh`), the growth of its lifetime counter, or — while neither
|
||||||
|
is decoded, which is the case today — AC power integrated over time
|
||||||
|
(trapezoid between consecutive readings, gaps over 5 min not bridged). The
|
||||||
|
estimate is flagged (`estimated: true` in the API, "≈" on the dashboard).
|
||||||
|
Lifetime energy shows "not available yet" until `total_energy_wh` is sent.
|
||||||
|
|
||||||
|
The current state of the register map is in `poller/README.md`.
|
||||||
|
|
||||||
## Data retention
|
## Data retention
|
||||||
|
|
||||||
Raw readings older than `RETENTION_DAYS` (730) are purged every 6 h. The
|
Raw readings older than `RETENTION_DAYS` (730) are purged every 6 h. The
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ the on-site side: read the inverters, POST the values.
|
|||||||
use it to send. It's standard library only. It timestamps readings, keeps
|
use it to send. It's standard library only. It timestamps readings, keeps
|
||||||
them in `unsent_readings.jsonl` when the internet is down, re-sends them
|
them in `unsent_readings.jsonl` when the internet is down, re-sends them
|
||||||
later, and never raises.
|
later, and never raises.
|
||||||
- `README.md` (next to this brief): the field names, units and scalings.
|
- `README.md` (next to this brief): the field names, units and the current
|
||||||
|
state of the register map (what's verified, what isn't sent yet).
|
||||||
|
|
||||||
## What to do every 60 s
|
## What to do every 60 s
|
||||||
|
|
||||||
@@ -44,9 +45,9 @@ while True:
|
|||||||
e.g. `INV1`..`INV5` matching labels on the units. It's the database key.
|
e.g. `INV1`..`INV5` matching labels on the units. It's the database key.
|
||||||
Pretty names are set later in the dashboard, not here. Allowed characters:
|
Pretty names are set later in the dashboard, not here. Allowed characters:
|
||||||
letters, digits, `_ . -`.
|
letters, digits, `_ . -`.
|
||||||
3. **Send converted values**, not raw ones, using the keys and scalings in
|
3. **Send converted values**, not raw ones, using the keys in `README.md`.
|
||||||
`README.md` (e.g. `ac_voltage_l1_v` = P050 raw / 40). Leave out anything
|
Leave out anything you couldn't read or haven't verified; every field is
|
||||||
you couldn't read; every field is optional.
|
optional. Timestamps must be real UTC (see README).
|
||||||
4. **New or unconfirmed parameters:** send them too, under a descriptive key
|
4. **New or unconfirmed parameters:** send them too, under a descriptive key
|
||||||
(e.g. `p0xx_raw`). The backend stores unknown keys and shows them on the
|
(e.g. `p0xx_raw`). The backend stores unknown keys and shows them on the
|
||||||
inverter page under "Other (unmapped)". Tell the owner when a mapping is
|
inverter page under "Other (unmapped)". Tell the owner when a mapping is
|
||||||
|
|||||||
+32
-15
@@ -1,6 +1,6 @@
|
|||||||
# On-site poller
|
# On-site poller
|
||||||
|
|
||||||
`refusol_poller.py` (not in this repo yet) reads the inverters over USS/TCP
|
`refusol_poller.py` (lives on the site laptop, not in this repo) reads the inverters over USS/TCP
|
||||||
(port 21062, USS address 0). It sends each cycle to the backend through
|
(port 21062, USS address 0). It sends each cycle to the backend through
|
||||||
`backend_client.py` — copy that file next to the poller.
|
`backend_client.py` — copy that file next to the poller.
|
||||||
|
|
||||||
@@ -30,20 +30,37 @@ Each dict uses the keys below (all optional — send what was read). Anything
|
|||||||
else you include (e.g. a newly discovered parameter as `"p0xx_raw": 1234`) is
|
else you include (e.g. a newly discovered parameter as `"p0xx_raw": 1234`) is
|
||||||
stored too and shows under "Other (unmapped)" on the inverter page.
|
stored too and shows under "Other (unmapped)" on the inverter page.
|
||||||
|
|
||||||
| key | unit | source |
|
State of the map as verified on site (2026-10-21):
|
||||||
|---|---|---|
|
|
||||||
| `ac_voltage_l1_v` / `_l2_v` / `_l3_v` | V | P050 / P05B / P064 raw / 40 |
|
| key | unit | status | source |
|
||||||
| `dc_voltage_mppt1_v` / `_mppt2_v` | V | P052 / P054 raw / 40 |
|
|---|---|---|---|
|
||||||
| `dc_current_mppt1_a` / `_mppt2_a` | A | P05A / P05C raw / 10 |
|
| `ac_power_total_w` | W | ✅ sent | **Computed** by the poller: Σ (phase V × phase I), forced to 0 when the inverter isn't feeding. *Not* P06D — P06D sits latched at 21450 on any feeding unit (nameplate/limit, not live power). |
|
||||||
| `ac_current_l1_a` / `_l2_a` / `_l3_a` | A | P068 / P069 / P06A raw / 100 |
|
| `ac_voltage_l1_v` / `_l2_v` / `_l3_v` | V | ✅ sent | P050 / P05B / P064 raw / 40 |
|
||||||
| `ac_power_total_w` | W | P06D raw |
|
| `ac_current_l1_a` / `_l2_a` / `_l3_a` | A | ✅ sent | P068 / P069 / P06A raw / 100 |
|
||||||
| `grid_frequency_hz` | Hz | P06C raw / 20 |
|
| `grid_frequency_hz` | Hz | ✅ sent | P06C raw / 20 |
|
||||||
| `temperature_c` | °C | P070 raw >> 16 |
|
| `temperature_c` | °C | ✅ sent | P070 raw >> 16 |
|
||||||
| `daily_energy_wh` | Wh | P063 IND=0 raw × 10 |
|
| `status_code` | – | ✅ sent | PZD status word. **7 and 8 = feeding** (7 on INV1's OEM board, 8 on the standard units); anything else shows as Standby. Other values not decoded yet. |
|
||||||
| `total_energy_wh` | Wh | P063 IND=11 raw |
|
| `status_text` | – | ✅ sent | `"feeding"` / `"standby/not feeding"` |
|
||||||
| `status_code` | – | inverter state, once identified |
|
| `dc_voltage_mppt1_v` / `_mppt2_v` | V | ❌ not sent | P052 / P054 are static nameplate/limit values, not live. Real registers TBD. |
|
||||||
| `error_code` | – | non-zero = fault (shows the inverter as **Fault**) |
|
| `dc_current_mppt1_a` / `_mppt2_a` | A | ❌ not sent | P05A / P05C likewise static. Real registers TBD. |
|
||||||
| `status_text` | – | optional human text for the code |
|
| `daily_energy_wh` | Wh | ❌ not sent | P063 IND=0 is frozen, not accumulating. Real register TBD. Until then the backend **estimates** daily energy by integrating `ac_power_total_w` (shown with ≈). |
|
||||||
|
| `total_energy_wh` | Wh | ❌ not sent | P063 IND=11 decode wrong. Real register TBD. Lifetime shows "not available yet". |
|
||||||
|
| `error_code` | – | ❌ not sent | No fault register confirmed yet. Absent = no fault. Non-zero will show the inverter as **Fault**. |
|
||||||
|
|
||||||
|
Unmapped diagnostics currently sent (stored, shown under "Other (unmapped)",
|
||||||
|
never treated as telemetry): `p06d_raw_latched`, `p052_static_v`,
|
||||||
|
`p05a_static_a`, `p063_ind0_raw`.
|
||||||
|
|
||||||
|
Inverter IDs (permanent database keys): INV1 = 192.168.1.11, INV2 =
|
||||||
|
192.168.1.12, INV3 = 192.168.1.13 (reserved, not connected yet), INV4 =
|
||||||
|
192.168.1.221, INV5 = REFUsol 20K-3T (reserved, no read path yet). An
|
||||||
|
inverter appears on the dashboard the first time it reports.
|
||||||
|
|
||||||
|
**Timestamps must be UTC.** Send them with the right offset (e.g.
|
||||||
|
`datetime.now(timezone.utc).isoformat()`), or leave `timestamp` out and let
|
||||||
|
`backend_client.py` add it. A reading stamped more than 5 min in the future
|
||||||
|
(e.g. local Athens time labelled `+00:00`) is stored at the time it was
|
||||||
|
received instead, and the response's `clamped_future` count says so.
|
||||||
|
|
||||||
`send()` stamps each reading with the current UTC time, buffers to
|
`send()` stamps each reading with the current UTC time, buffers to
|
||||||
`unsent_readings.jsonl` when the internet is down and re-sends later, and
|
`unsent_readings.jsonl` when the internet is down and re-sends later, and
|
||||||
|
|||||||
+26
-35
@@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
python fake_poller.py --url http://localhost:8090 --key change-me --backfill-days 30
|
python fake_poller.py --url http://localhost:8090 --key change-me --backfill-days 30
|
||||||
|
|
||||||
--backfill-days first loads that many days of history (one reading per
|
Sends what the real poller sends today (AC side, temperature, status code,
|
||||||
5 minutes), then it posts live readings every --interval seconds. Inverter
|
unmapped diagnostics; no DC or energy counters). --backfill-days first loads
|
||||||
INV3 runs with a dead MPPT2 string so the warnings show up.
|
that many days of history (one reading per 5 minutes), then it posts live
|
||||||
|
readings every --interval seconds. INV4 runs at half output (as if a string
|
||||||
|
fuse had blown) so the warnings show up.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@@ -15,7 +17,7 @@ from datetime import datetime, timedelta, timezone
|
|||||||
|
|
||||||
from backend_client import BackendClient
|
from backend_client import BackendClient
|
||||||
|
|
||||||
INVERTERS = ["INV1", "INV2", "INV3", "INV4", "INV5"]
|
INVERTERS = ["INV1", "INV2", "INV4"]
|
||||||
PEAK_W = 18_000
|
PEAK_W = 18_000
|
||||||
|
|
||||||
|
|
||||||
@@ -26,40 +28,32 @@ def sun_factor(t: datetime) -> float:
|
|||||||
return max(0.0, math.sin(math.pi * x)) if 0 < x < 1 else 0.0
|
return max(0.0, math.sin(math.pi * x)) if 0 < x < 1 else 0.0
|
||||||
|
|
||||||
|
|
||||||
def reading(inv: str, t: datetime, state: dict) -> dict | None:
|
def reading(inv: str, t: datetime) -> dict | None:
|
||||||
f = sun_factor(t) * random.uniform(0.93, 1.0)
|
f = sun_factor(t) * random.uniform(0.93, 1.0)
|
||||||
if f <= 0.01:
|
if f <= 0.01:
|
||||||
return None # inverter asleep at night, doesn't answer
|
return None # inverter asleep at night, doesn't answer
|
||||||
dead_mppt2 = inv == "INV3"
|
feeding = f > 0.03
|
||||||
p_dc1 = PEAK_W / 2 * f
|
w = int(PEAK_W * f * (0.5 if inv == "INV4" else 1.0)) if feeding else 0
|
||||||
p_dc2 = 0 if dead_mppt2 else PEAK_W / 2 * f
|
volts = [round(random.uniform(229, 236), 2) for _ in range(3)]
|
||||||
v1, v2 = 560 + 60 * f, 560 + 60 * f
|
amps = [round(w / 3 / v, 2) for v in volts]
|
||||||
ac = int((p_dc1 + p_dc2) * 0.97)
|
|
||||||
day = t.date()
|
|
||||||
if state.get((inv, "day")) != day:
|
|
||||||
state[(inv, "day")] = day
|
|
||||||
state[(inv, "daily")] = 0
|
|
||||||
state[(inv, "daily")] += ac * state["step"] / 3600
|
|
||||||
state[(inv, "total")] = state.get((inv, "total"), 40_000_000) + ac * state["step"] / 3600
|
|
||||||
i_ac = ac / 3 / 230
|
|
||||||
return {
|
return {
|
||||||
"inverter_id": inv,
|
"inverter_id": inv,
|
||||||
"timestamp": t.isoformat(timespec="seconds"),
|
"timestamp": t.isoformat(timespec="seconds"),
|
||||||
"ac_voltage_l1_v": round(random.uniform(228, 236), 1),
|
"ac_voltage_l1_v": volts[0],
|
||||||
"ac_voltage_l2_v": round(random.uniform(228, 236), 1),
|
"ac_voltage_l2_v": volts[1],
|
||||||
"ac_voltage_l3_v": round(random.uniform(228, 236), 1),
|
"ac_voltage_l3_v": volts[2],
|
||||||
"dc_voltage_mppt1_v": round(v1, 1),
|
"ac_current_l1_a": amps[0],
|
||||||
"dc_voltage_mppt2_v": round(v2 if not dead_mppt2 else 30.0, 1),
|
"ac_current_l2_a": amps[1],
|
||||||
"dc_current_mppt1_a": round(p_dc1 / v1, 1),
|
"ac_current_l3_a": amps[2],
|
||||||
"dc_current_mppt2_a": round(p_dc2 / v2, 1),
|
"ac_power_total_w": w,
|
||||||
"ac_current_l1_a": round(i_ac, 2),
|
|
||||||
"ac_current_l2_a": round(i_ac, 2),
|
|
||||||
"ac_current_l3_a": round(i_ac, 2),
|
|
||||||
"ac_power_total_w": ac,
|
|
||||||
"grid_frequency_hz": round(random.uniform(49.95, 50.05), 2),
|
"grid_frequency_hz": round(random.uniform(49.95, 50.05), 2),
|
||||||
"temperature_c": int(30 + 25 * f),
|
"temperature_c": int(30 + 25 * f),
|
||||||
"daily_energy_wh": int(state[(inv, "daily")] // 10 * 10),
|
"status_code": (7 if inv == "INV1" else 8) if feeding else 3,
|
||||||
"total_energy_wh": int(state[(inv, "total")]),
|
"status_text": "feeding" if feeding else "standby/not feeding",
|
||||||
|
"p06d_raw_latched": 21450,
|
||||||
|
"p052_static_v": 312.5,
|
||||||
|
"p05a_static_a": 45.0,
|
||||||
|
"p063_ind0_raw": 1872,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -72,13 +66,11 @@ def main() -> None:
|
|||||||
args = ap.parse_args()
|
args = ap.parse_args()
|
||||||
client = BackendClient(args.url, args.key, spool_path="fake_unsent.jsonl")
|
client = BackendClient(args.url, args.key, spool_path="fake_unsent.jsonl")
|
||||||
|
|
||||||
state: dict = {}
|
|
||||||
if args.backfill_days:
|
if args.backfill_days:
|
||||||
state["step"] = 300
|
|
||||||
t = datetime.now(timezone.utc) - timedelta(days=args.backfill_days)
|
t = datetime.now(timezone.utc) - timedelta(days=args.backfill_days)
|
||||||
batch: list[dict] = []
|
batch: list[dict] = []
|
||||||
while t < datetime.now(timezone.utc):
|
while t < datetime.now(timezone.utc):
|
||||||
batch += [r for inv in INVERTERS if (r := reading(inv, t, state))]
|
batch += [r for inv in INVERTERS if (r := reading(inv, t))]
|
||||||
if len(batch) >= 1000:
|
if len(batch) >= 1000:
|
||||||
client.send(batch)
|
client.send(batch)
|
||||||
batch = []
|
batch = []
|
||||||
@@ -86,10 +78,9 @@ def main() -> None:
|
|||||||
client.send(batch)
|
client.send(batch)
|
||||||
print(f"Backfilled {args.backfill_days} days")
|
print(f"Backfilled {args.backfill_days} days")
|
||||||
|
|
||||||
state["step"] = args.interval
|
|
||||||
while True:
|
while True:
|
||||||
now = datetime.now(timezone.utc)
|
now = datetime.now(timezone.utc)
|
||||||
batch = [r for inv in INVERTERS if (r := reading(inv, now, state))]
|
batch = [r for inv in INVERTERS if (r := reading(inv, now))]
|
||||||
ok = client.send(batch)
|
ok = client.send(batch)
|
||||||
print(f"{now:%H:%M:%S} sent {len(batch)} readings, ok={ok}")
|
print(f"{now:%H:%M:%S} sent {len(batch)} readings, ok={ok}")
|
||||||
time.sleep(args.interval)
|
time.sleep(args.interval)
|
||||||
|
|||||||
Reference in New Issue
Block a user