# On-site poller `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 `backend_client.py` — copy that file next to the poller. ## Wiring it into `refusol_poller.py` At the top of the file: ```python from backend_client import BackendClient BACKEND_URL = "https://solar.bonamin.net" API_KEY = "same value as API_KEY in the server's .env" backend = BackendClient(BACKEND_URL, API_KEY) ``` At the end of every poll cycle, one dict per inverter that answered: ```python readings = [] for inverter_id, values in polled.items(): # however the poller holds them readings.append({"inverter_id": inverter_id, **values}) backend.send(readings) # also call it when the list is empty ``` 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 stored too and shows under "Other (unmapped)" on the inverter page. State of the map as verified on site (2026-10-21): | key | unit | status | source | |---|---|---|---| | `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_voltage_l1_v` / `_l2_v` / `_l3_v` | V | ✅ sent | P050 / P05B / P064 raw / 40 | | `ac_current_l1_a` / `_l2_a` / `_l3_a` | A | ✅ sent | P068 / P069 / P06A raw / 100 | | `grid_frequency_hz` | Hz | ✅ sent | P06C raw / 20 | | `temperature_c` | °C | ✅ sent | P070 raw >> 16 | | `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. | | `status_text` | – | ✅ sent | `"feeding"` / `"standby/not feeding"` | | `dc_voltage_mppt1_v` / `_mppt2_v` | V | ❌ not sent | P052 / P054 are static nameplate/limit values, not live. Real registers TBD. | | `dc_current_mppt1_a` / `_mppt2_a` | A | ❌ not sent | P05A / P05C likewise static. Real registers TBD. | | `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 `unsent_readings.jsonl` when the internet is down and re-sends later, and never raises — a backend problem can't stop the polling loop. **Call `send([])` even when no inverter answered.** That's the heartbeat that lets the dashboard say "inverter not responding" (site online) instead of "datalogger offline" (site/internet down). ## Trying the dashboard without the site ```bash python fake_poller.py --url http://localhost:8090 --key change-me --backfill-days 30 ```