Releases: MateoGreil/python-comwatt-client
Release list
v0.3.5
What's Changed
- ✨ Capacity actuator helpers —
set_pilot_wire,set_thermal_mode,set_thermostat_set_point(PUT /capacities/{id}/...) (#45) - 🗑️ Deprecate the two
*-time-agoaggregation methods —get_site_networks_ts_time_ago→get_site_time_series,get_site_consumption_breakdown_time_ago→get_top_consumption. The old endpoints still work; the methods are kept as thin aliases that emit aDeprecationWarning. (#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
What's Changed
- 🐛
authenticate()now raisesComwattAPIErrorinstead ofComwattAuthErrorfor non-credential failures: any non-200/401/403 status onPOST /v1/authent(e.g. 5xx during an outage) and the HTTP-200-but-missing-cwt_session-cookie anomaly.ComwattAuthErroris now reserved for rejected credentials (401/403) and invalid sessions.
Full Changelog: 0.3.3...0.3.4
0.3.3
0.3.2
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 soauto_reauthcannot silently restore the session. Idempotent (a 401 when already logged out is a no-op); distinct fromclose(), which only releases the local HTTP session. (#39)
Full Changelog: 0.3.1...0.3.2
0.3.1
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.pyinto domain mixin modules (_auth,_sites,_devices,_aggregations,_connected_objects,_grid,_core). Purely internal — the publicComwattClientAPI is unchanged. (#38)
Full Changelog: 0.3.0...0.3.1
0.3.0
Feature release: two new aggregation endpoints and automated PyPI publishing.
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-pythonraised to>=3.10, CI matrix and trove classifiers updated. If you are still on Python 3.9, pincomwatt-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
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 carrystatus_code,url,detailand the rawresponse. is_authenticated()— cheap probe ofGET /users/authenticatedthat returnsTrue/False(treats 401/403 as "re-login required").- Automatic re-authentication: on a
401the client re-logs in with the stored credentials and retries the request once (toggle withauto_reauth=False). - Configurable request
timeouton every HTTP call (ComwattClient(timeout=30)), so a stalled connection can no longer hang forever. close()+ context-manager support —with ComwattClient() as c: ...releases the underlyingrequests.Session.- Absolute
start/endtime window on all aggregation methods (get_device_ts_time_ago,get_site_networks_ts_time_ago,get_site_consumption_breakdown_time_ago), acceptingdatetimeor ISO-8601 strings, in addition to the relativetime_ago_*parameters. - Type hints across the client + PEP 561
py.typedmarker (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_sessioncookie was actually set (a200with no cookie raisesComwattAuthError). - 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.py→pyproject.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'sTrue/False.- Documented defaults of
get_site_networks_ts_time_agosynced with the real signature (FLOW/NONE, notVIRTUAL_QUANTITY/HOUR/SUM).
Security
- Minimum
requests>=2.32.4(the previously pinned2.31.0is affected by CVE-2024-35195). - Dev dependency
pytestbumped tov9.
Docs
- Added reverse-engineered
energy.comwatt.comAPI field notes underdocs/(endpoints, aggregations, WebSocket streaming), live-verified 2026-07-04.
0.2.3
What's Changed
- Update Comwatt API call by @plazareff in #4
New Contributors
- @plazareff made their first contribution in #4
Full Changelog: 0.2.2...0.2.3