Skip to content

Releases: MateoGreil/python-comwatt-client

v0.3.5

Choose a tag to compare

@MateoGreil MateoGreil released this 08 Jul 09:15

What's Changed

  • Capacity actuator helpersset_pilot_wire, set_thermal_mode, set_thermostat_set_point (PUT /capacities/{id}/...) (#45)
  • 🗑️ Deprecate the two *-time-ago aggregation methodsget_site_networks_ts_time_agoget_site_time_series, get_site_consumption_breakdown_time_agoget_top_consumption. The old endpoints still work; the methods are kept as thin aliases that emit a DeprecationWarning. (#44)
  • ⬆️ Update dependency mypy to v2.2.0 (#47)

Verification

All 22 public methods were exercised live against the production energy.comwatt.com API (reads real; put_device as a no-op round-trip; switch_capacity idempotent via WebSocket-confirmed current state). The three thermostat/pilot-wire setters could not be exercised (no compatible hardware on the test account).

Full changelog: 0.3.4...0.3.5

v0.3.4

Choose a tag to compare

@MateoGreil MateoGreil released this 05 Jul 10:53

What's Changed

  • 🐛 authenticate() now raises ComwattAPIError instead of ComwattAuthError for non-credential failures: any non-200/401/403 status on POST /v1/authent (e.g. 5xx during an outage) and the HTTP-200-but-missing-cwt_session-cookie anomaly. ComwattAuthError is now reserved for rejected credentials (401/403) and invalid sessions.

Full Changelog: 0.3.3...0.3.4

0.3.3

Choose a tag to compare

@MateoGreil MateoGreil released this 05 Jul 09:45

Full Changelog: 0.3.2...0.3.3

0.3.2

Choose a tag to compare

@MateoGreil MateoGreil released this 05 Jul 08:56

Feature release: adds a proper server-side logout. No breaking changes — Python ≥ 3.10 still required.

Added

  • logout() — logs the current session out server-side (POST /v1/logout) and clears the stored credentials so auto_reauth cannot silently restore the session. Idempotent (a 401 when already logged out is a no-op); distinct from close(), which only releases the local HTTP session. (#39)

Full Changelog: 0.3.1...0.3.2

0.3.1

Choose a tag to compare

@MateoGreil MateoGreil released this 05 Jul 08:38

Feature release: seven new read endpoints and an internal refactor of the client into domain modules. No breaking changes — Python ≥ 3.10 still required.

Added

  • get_connected_objects() — list connected objects for a site or gateway (GET /connectedobjects). (#31)
  • get_connected_object() — fetch a single connected object by id (GET /connectedobjects/{id}). (#32)
  • get_measure_keys() — per-site measurement inventory, a flat catalogue of every (device, measureKind) pair (GET /measurekeys/measurekeys). (#33)
  • get_tiles() — dashboard tile configuration for a site (GET /tiles). (#34)
  • get_device_kinds() — device-kind catalogue by site UID (GET /devicekinds/by-site-uid/{siteUid}). (#35)
  • get_ecowatt() — RTE EcoWatt grid-stress forecast (GET /ecowatt). (#36)
  • get_electricity_price() — EDF Tempo calendar / tariff structure for a site (GET /electricityprice). (#37)

Changed

  • ♻️ Split the monolithic client.py into domain mixin modules (_auth, _sites, _devices, _aggregations, _connected_objects, _grid, _core). Purely internal — the public ComwattClient API is unchanged. (#38)

Full Changelog: 0.3.0...0.3.1

0.3.0

Choose a tag to compare

@MateoGreil MateoGreil released this 05 Jul 07:18

Feature release: two new aggregation endpoints and automated PyPI publishing. ⚠️ Drops Python 3.9 (EOL) — Python ≥ 3.10 is now required.

Added

  • get_site_time_series() — whole-site rollup (GET /aggregations/site-time-series), supporting the same relative (time_ago_*) and absolute (start/end) time windows as the other aggregation methods. Defaults: measure_kind="FLOW", aggregation_level="HOUR", aggregation_type="SUM". (#27)
  • get_top_consumption() — per-device consumption breakdown (GET /aggregations/top-consumption): the top consuming devices with their percentage share, plus an "other" bucket. Reuses the shared aggregation query helper (relative & absolute windows), fully type-annotated. (#28)

Changed

  • 💥 Dropped Python 3.9 support (EOL since October 2025): requires-python raised to >=3.10, CI matrix and trove classifiers updated. If you are still on Python 3.9, pin comwatt-client==0.2.4. (#30)

CI

  • Automated PyPI publishing via GitHub Actions trusted publishing (no API tokens): publishing a GitHub release now builds the sdist + wheel and uploads them to PyPI. (#29)

Full Changelog: 0.2.4...0.3.0

0.2.4

Choose a tag to compare

@MateoGreil MateoGreil released this 05 Jul 07:18

Reliability & developer-experience release. Fully backward-compatible — no breaking changes; all existing methods keep working.

Added

  • Typed exception hierarchy: ComwattError (base), ComwattAuthError (401 / failed login), ComwattAPIError (other HTTP errors). Now exported from the package root. Exceptions carry status_code, url, detail and the raw response.
  • is_authenticated() — cheap probe of GET /users/authenticated that returns True/False (treats 401/403 as "re-login required").
  • Automatic re-authentication: on a 401 the client re-logs in with the stored credentials and retries the request once (toggle with auto_reauth=False).
  • Configurable request timeout on every HTTP call (ComwattClient(timeout=30)), so a stalled connection can no longer hang forever.
  • close() + context-manager supportwith ComwattClient() as c: ... releases the underlying requests.Session.
  • Absolute start/end time window on all aggregation methods (get_device_ts_time_ago, get_site_networks_ts_time_ago, get_site_consumption_breakdown_time_ago), accepting datetime or ISO-8601 strings, in addition to the relative time_ago_* parameters.
  • Type hints across the client + PEP 561 py.typed marker (the package now ships types to consumers / mypy).
  • Unit-test suite (pytest, HTTP mocked with responses) and CI (Forgejo Actions + GitHub Actions).

Changed

  • Login now verifies the cwt_session cookie was actually set (a 200 with no cookie raises ComwattAuthError).
  • All HTTP calls routed through a single internal _request() helper (consistent error handling, timeout and re-auth).
  • Aggregation query-strings built by a shared _aggregations_query() helper.
  • Packaging migrated setup.pypyproject.toml (PEP 621), with self-hosted Renovate for dependency updates.
  • README refreshed (usage example, method defaults).

Fixed

  • Wrong import in the README example (from comwatt.client …from comwatt_client …).
  • Copy-pasted "Error retrieving sites" messages in the device/capacity methods now report the right context.
  • switch_capacity() sends a lowercase boolean (?enable=true|false) instead of Python's True/False.
  • Documented defaults of get_site_networks_ts_time_ago synced with the real signature (FLOW / NONE, not VIRTUAL_QUANTITY / HOUR / SUM).

Security

  • Minimum requests>=2.32.4 (the previously pinned 2.31.0 is affected by CVE-2024-35195).
  • Dev dependency pytest bumped to v9.

Docs

  • Added reverse-engineered energy.comwatt.com API field notes under docs/ (endpoints, aggregations, WebSocket streaming), live-verified 2026-07-04.

0.2.3

Choose a tag to compare

@MateoGreil MateoGreil released this 16 Jul 14:15

What's Changed

New Contributors

Full Changelog: 0.2.2...0.2.3

0.2.2

Choose a tag to compare

@MateoGreil MateoGreil released this 27 Jan 15:34
b7f80ae

Full Changelog: 0.2.1...0.2.2

0.2.1

Choose a tag to compare

@MateoGreil MateoGreil released this 26 Mar 17:06

Full Changelog: 0.2...0.2.1