✨ feat: get_site_network_time_series(site_id, site_network_type) #167

Merged
mat merged 1 commit from feat/site-network-time-series into main 2026-10-27 10:38:14 +00:00
Owner

Summary

 AggregationsMixin (_aggregations.py)
+  get_site_network_time_series(site_id, site_network_type, ...)
+    → GET /api/aggregations/time-series?id={siteId}&siteNetworkType={type}&...

Exposes the site-addressed siteNetworkType overload of the time-series endpoint (live-verified 2026-10-11 — all six types return 200): read one of the site's virtual networks directly, including the battery flows. site_network_type is a required positional (PRODUCTION, CONSUMPTION, INJECTION, WITHDRAWAL, CHARGE, DISCHARGE); the docstring pins the set and documents that BATTERY/GRID are rejected with 400 (use the directional CHARGE/DISCHARGE). Response is the device-style {timestamps, values} and goes through the same normalize_time_series float/None cleanup. Signature and absolute-window semantics mirror get_device_ts_time_ago.

Evidence

  • Before: the overload existed only in the field notes; no client method exposed it — the battery flows were unreadable through the client.
  • After: 4 new tests — default call (query set incl. siteNetworkType=CONSUMPTION, aggregationType omitted, values normalized to float), battery CHARGE with full custom params (incl. timeAgoUnit=WEEK, which is valid there), absolute window (start/end sent, timeAgo* absent), 500 → ComwattAPIError; pytest = 220 passed; mypy clean.

Merge Danger

Door: two-way — purely additive method; revert removes it cleanly.

Blast Radius: minimal — one new public method; _aggregations_query gains an optional keyword that existing callers never pass.

Closes #102 (with #166 covering the docstring-enum half)

## Summary ```diff AggregationsMixin (_aggregations.py) + get_site_network_time_series(site_id, site_network_type, ...) + → GET /api/aggregations/time-series?id={siteId}&siteNetworkType={type}&... ``` Exposes the site-addressed `siteNetworkType` overload of the `time-series` endpoint (live-verified 2026-10-11 — all six types return 200): read one of the site's virtual networks directly, including the battery flows. `site_network_type` is a required positional (`PRODUCTION`, `CONSUMPTION`, `INJECTION`, `WITHDRAWAL`, `CHARGE`, `DISCHARGE`); the docstring pins the set and documents that `BATTERY`/`GRID` are rejected with 400 (use the directional `CHARGE`/`DISCHARGE`). Response is the device-style `{timestamps, values}` and goes through the same `normalize_time_series` float/None cleanup. Signature and absolute-window semantics mirror `get_device_ts_time_ago`. ## Evidence - **Before:** the overload existed only in the field notes; no client method exposed it — the battery flows were unreadable through the client. - **After:** 4 new tests — default call (query set incl. `siteNetworkType=CONSUMPTION`, `aggregationType` omitted, values normalized to float), battery `CHARGE` with full custom params (incl. `timeAgoUnit=WEEK`, which is valid there), absolute window (`start`/`end` sent, `timeAgo*` absent), 500 → `ComwattAPIError`; `pytest` = **220 passed**; `mypy` clean. ## Merge Danger **Door:** two-way — purely additive method; revert removes it cleanly. **Blast Radius:** minimal — one new public method; `_aggregations_query` gains an optional keyword that existing callers never pass. Closes #102 (with #166 covering the docstring-enum half)
✨ feat: get_site_network_time_series(site_id, site_network_type) (#102)
All checks were successful
Tests / forgejo-pytest (pull_request) Successful in 43s
Tests / forgejo-pytest (push) Successful in 43s
fa0df4a4b1
mat changed title from WIP: ✨ feat: get_site_network_time_series(site_id, site_network_type) to ✨ feat: get_site_network_time_series(site_id, site_network_type) 2026-10-27 10:38:11 +00:00
mat merged commit 959c64943c into main 2026-10-27 10:38:14 +00:00
mat deleted branch feat/site-network-time-series 2026-10-27 10:38:14 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mat/python-comwatt-client!167
No description provided.