✨ feat: catalogue methods (get_products, get_timezones, get_modbus_configurations) #153

Merged
mat merged 1 commit from feat/catalogue-methods into main 2026-10-27 09:49:38 +00:00
Owner

Summary

 ComwattClient (MRO: auth, alert-configs, aggregations, capacities, ...)
+  CataloguesMixin (_catalogues.py)     # read-only catalogues, flat client.get_*
+    get_products()                     → GET /api/products
+    get_timezones()                    → GET /api/util/timezones
+    get_modbus_configurations()        → GET /api/gateways/modbus-configurations

Three catalogue reads from issue #97, all live-verified 200 (2026-10-11 lineage, see docs/energy.comwatt.com/misc-endpoints.md + devices.md):

  • products — hardware catalogue ({id, name, brand, cardinality, features})
  • timezones — static {timeZone, posix} pairs
  • modbus-configurations — Modbus device-family catalogue; device_kinds key is snake_case (documented, passed through as-is). Pairing (POST /devices/v2/modbus) stays out — installer flow.

Follow-ups tracked separately: get_product(product_id) (#152), mixin/proxy architecture audit (#151).

Evidence

  • Before: AttributeError: 'ComwattClient' object has no attribute 'get_modbus_configurations' — methods didn't exist; baseline pytest = 173 passed.
  • After: 6 new mocked tests (tests/test_catalogues.py: happy path + 500→ComwattAPIError per method, asserting method/path/query); pytest = 179 passed; mypy clean.

Merge Danger

Door: two-way — purely additive; revert restores the previous client exactly.

Blast Radius: minimal — 3 new public methods, no existing method touched; one mixin added to the MRO chain of ComwattClient.

Closes #97

## Summary ```diff ComwattClient (MRO: auth, alert-configs, aggregations, capacities, ...) + CataloguesMixin (_catalogues.py) # read-only catalogues, flat client.get_* + get_products() → GET /api/products + get_timezones() → GET /api/util/timezones + get_modbus_configurations() → GET /api/gateways/modbus-configurations ``` Three catalogue reads from issue #97, all live-verified 200 (2026-10-11 lineage, see `docs/energy.comwatt.com/misc-endpoints.md` + `devices.md`): - **products** — hardware catalogue (`{id, name, brand, cardinality, features}`) - **timezones** — static `{timeZone, posix}` pairs - **modbus-configurations** — Modbus device-family catalogue; `device_kinds` key is snake_case (documented, passed through as-is). Pairing (`POST /devices/v2/modbus`) stays out — installer flow. Follow-ups tracked separately: `get_product(product_id)` (#152), mixin/proxy architecture audit (#151). ## Evidence - **Before:** `AttributeError: 'ComwattClient' object has no attribute 'get_modbus_configurations'` — methods didn't exist; baseline `pytest` = 173 passed. - **After:** 6 new mocked tests (`tests/test_catalogues.py`: happy path + 500→`ComwattAPIError` per method, asserting method/path/query); `pytest` = **179 passed**; `mypy` clean. ## Merge Danger **Door:** two-way — purely additive; revert restores the previous client exactly. **Blast Radius:** minimal — 3 new public methods, no existing method touched; one mixin added to the MRO chain of `ComwattClient`. Closes #97
✨ feat: catalogue methods (get_products, get_timezones, get_modbus_configurations) (#97)
All checks were successful
Tests / forgejo-pytest (pull_request) Successful in 44s
Tests / forgejo-pytest (push) Successful in 43s
434dfe1185
mat changed title from WIP: ✨ feat: catalogue methods (get_products, get_timezones, get_modbus_configurations) to ✨ feat: catalogue methods (get_products, get_timezones, get_modbus_configurations) 2026-10-27 09:49:35 +00:00
mat merged commit cd59543d68 into main 2026-10-27 09:49:38 +00:00
mat deleted branch feat/catalogue-methods 2026-10-27 09:49:39 +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!153
No description provided.