Add generic ENLYZE power meter pipeline

This commit is contained in:
2026-10-01 11:59:34 +02:00
parent 4a3ed625ce
commit e9f9cf6f3c
15 changed files with 680 additions and 4 deletions
+39
View File
@@ -56,6 +56,10 @@ The second command saves a sanitized, reviewable fixture under
`fixtures/enlyze/` by default. Raw captures belong in the ignored
`data/raw/enlyze/` directory and must not be committed.
The `/v2/variables` exploration path automatically follows cursor pagination,
so the emitted response contains all variable pages. Non-2xx responses retain a
bounded, sanitized response body in the error for troubleshooting.
The OpenAPI server URL is `https://app.enlyze.com/api/`; its operation paths
begin with `/v2/`. Set `ENLYZE_BASE_URL` to that server URL, not to an
operation path. The documented read-only time-series operation is exposed for
@@ -217,6 +221,41 @@ start times, not source-sample timestamps. Schema application is manual.
Bento 1 bentonite source and gate selection remain intentionally undefined pending
process validation; the generic integration core is unchanged and reusable.
## Generic ENLYZE power meters
`config/power-meters.example.yaml` is the configuration-only B2 starting point.
It contains the verified machine, energy, active-power and frequency UUIDs; K1
and K6 are added as more `meters` entries without new code. Optional phase
channels are a mapping and may omit L2. `power_outages` is intentionally absent
until its real UUID is verified from the raw second `/v2/variables` page/register
1828; sanitized placeholders are never accepted.
Apply `db/schema.sql`, then run a bounded collection/backfill with ENLYZE and
PostgreSQL values from the environment or secret files:
```bash
production-analytics run power-meter --config config/power-meters.example.yaml \
--meter B2 --start 2026-09-01T00:00:00Z --end 2026-10-01T00:00:00Z
```
Generate the independent monthly PDF (under the configured mounted SMB path):
```bash
production-analytics report monthly --config config/power-meters.example.yaml \
--meter B2 --month 2026-09
```
The collector stores raw counters plus reset-safe increments in
`power_meter_readings`. Monthly reports preserve exact source timestamps for
the first/last reading, consumption, outage delta, frequency extrema and their
timestamps. PDF rendering needs WeasyPrint or `wkhtmltopdf`; report metadata is
stored in `power_meter_monthly_reports`. Grafana query templates are in
`db/power_meter_grafana.sql`.
For continuous collection, add `--follow`; without it the same command is a
bounded collector/backfill over `--start` and `--end` (or the latest polling
window when omitted).
## ERP current workplace status
The read-only ERP adapter reads production-order/article context from MSSQL