Add get_device_kinds (device-kind catalogue by site UID) #35

Merged
mat merged 1 commit from feat/get-device-kinds into main 2026-07-05 08:11:48 +00:00
Owner

Summary

Adds get_device_kinds(site_uid)GET /api/devicekinds/by-site-uid/{site_uid}.

Returns the catalogue of device kinds available for a site (the "add a device" picker: codes like SOLAR_PANEL, GRID_METER, PRO_HEAT_PUMP, …).

⚠️ Keyed by siteUid, not the numeric site id. Unlike every other site-scoped method (which takes the numeric site_id), this endpoint takes the short siteUid string (site["siteUid"], e.g. "992179e1"). The parameter is named site_uid and the docstring calls this out explicitly.

Uses the _request(...) helper (inherits timeout + auto-reauth on 401); mirrors the get_connected_object one-liner style.

Tests

tests/test_device_kinds.py (mirrors test_connected_objects.py's single-object tests): success (asserts path /api/devicekinds/by-site-uid/992179e1) and error (500 → ComwattAPIError). Full suite: 79 passed; mypy clean.

Notes

  • Endpoint live-verified (2026-07-04): returns a list (47 kinds on the test account).
  • README ## Features list updated.
  • Draft (WIP:) — remove the WIP prefix to mark ready for review.

Second of two independent slices for recommendation #16 (the other adds get_tiles, #34).

## Summary Adds `get_device_kinds(site_uid)` → `GET /api/devicekinds/by-site-uid/{site_uid}`. Returns the catalogue of device kinds available for a site (the "add a device" picker: codes like `SOLAR_PANEL`, `GRID_METER`, `PRO_HEAT_PUMP`, …). ⚠️ **Keyed by `siteUid`, not the numeric site id.** Unlike every other site-scoped method (which takes the numeric `site_id`), this endpoint takes the short `siteUid` string (`site["siteUid"]`, e.g. `"992179e1"`). The parameter is named `site_uid` and the docstring calls this out explicitly. Uses the `_request(...)` helper (inherits timeout + auto-reauth on 401); mirrors the `get_connected_object` one-liner style. ## Tests `tests/test_device_kinds.py` (mirrors `test_connected_objects.py`'s single-object tests): success (asserts path `/api/devicekinds/by-site-uid/992179e1`) and error (500 → `ComwattAPIError`). Full suite: **79 passed**; `mypy` clean. ## Notes - Endpoint live-verified (2026-07-04): returns a list (47 kinds on the test account). - README `## Features` list updated. - Draft (`WIP:`) — remove the WIP prefix to mark ready for review. _Second of two independent slices for recommendation #16 (the other adds `get_tiles`, #34)._
Add get_device_kinds (device-kind catalogue by site UID)
Some checks are pending
Tests / forgejo-pytest (pull_request) Waiting to run
Tests / forgejo-pytest (push) Waiting to run
da7fa7447b
mat changed title from WIP: Add get_device_kinds (device-kind catalogue by site UID) to Add get_device_kinds (device-kind catalogue by site UID) 2026-07-05 08:08:29 +00:00
mat force-pushed feat/get-device-kinds from da7fa7447b
Some checks are pending
Tests / forgejo-pytest (pull_request) Waiting to run
Tests / forgejo-pytest (push) Waiting to run
to 9df040928e
All checks were successful
Tests / forgejo-pytest (push) Successful in 43s
Tests / forgejo-pytest (pull_request) Successful in 42s
2026-07-05 08:11:16 +00:00
Compare
mat merged commit a3bd35edd8 into main 2026-07-05 08:11:48 +00:00
mat deleted branch feat/get-device-kinds 2026-07-05 08:11:48 +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!35
No description provided.