Add get_measure_keys (site measurement inventory) #33

Merged
mat merged 1 commit from feat/get-measure-keys into main 2026-07-05 07:52:41 +00:00
Owner

Summary

Adds ComwattClient.get_measure_keys(site_id) wrapping GET /api/measurekeys/measurekeys?siteId=.

Returns the flat per-site measurement inventory — one entry per (device, measureKind) pair, each with a stable numeric id and a measureKey UUID. It's a cheaper way to enumerate every metric on a site than walking the /devices tree, and a clean basis for an entity catalog (e.g. the Home Assistant integration).

Live-verified against the production backend (HTTP 200).

Changes

  • get_measure_keys(site_id) on ComwattClient (same _request + typed-error conventions as the other getters).
  • tests/test_measure_keys.py: success (asserts path /api/measurekeys/measurekeys + siteId query) and error (500 → ComwattAPIError).
  • README: new bullet in the Features list.

Test plan

  • pytest — 77 passed (75 existing + 2 new).
  • mypy comwatt_client — no issues.

Notes

  • Purely additive; no existing signature changed. Ships to main on its own.
  • Draft (WIP): remove the WIP: title prefix to mark ready for review.
## Summary Adds `ComwattClient.get_measure_keys(site_id)` wrapping `GET /api/measurekeys/measurekeys?siteId=`. Returns the flat per-site **measurement inventory** — one entry per `(device, measureKind)` pair, each with a stable numeric `id` and a `measureKey` UUID. It's a cheaper way to enumerate every metric on a site than walking the `/devices` tree, and a clean basis for an entity catalog (e.g. the Home Assistant integration). Live-verified against the production backend (HTTP 200). ## Changes - `get_measure_keys(site_id)` on `ComwattClient` (same `_request` + typed-error conventions as the other getters). - `tests/test_measure_keys.py`: success (asserts path `/api/measurekeys/measurekeys` + `siteId` query) and error (500 → `ComwattAPIError`). - README: new bullet in the Features list. ## Test plan - [x] `pytest` — 77 passed (75 existing + 2 new). - [x] `mypy comwatt_client` — no issues. ## Notes - Purely additive; no existing signature changed. Ships to `main` on its own. - Draft (WIP): remove the `WIP:` title prefix to mark ready for review.
Add get_measure_keys (site measurement inventory)
All checks were successful
Tests / forgejo-pytest (push) Successful in 42s
Tests / forgejo-pytest (pull_request) Successful in 43s
6882381754
Wraps GET /api/measurekeys/measurekeys?siteId= — returns the flat
per-site inventory of (device, measureKind) pairs, each with a stable
numeric id and measureKey UUID. Live-verified 200.

- get_measure_keys(site_id) on ComwattClient
- tests: success (path + siteId query) and error (500 -> ComwattAPIError)
- README: features bullet
mat changed title from WIP: Add get_measure_keys (site measurement inventory) to Add get_measure_keys (site measurement inventory) 2026-07-05 07:52:19 +00:00
mat merged commit ca01696c47 into main 2026-07-05 07:52:41 +00:00
mat deleted branch feat/get-measure-keys 2026-07-05 07:52:41 +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!33
No description provided.