v1.10.2 - Bug fixes and hardening
Bug fixes
1. Wrong manufacturer / portal link for SEMM and Vivaigo contracts
The device card created for each contract was always labelled "Société des Eaux de Marseille" with a link to the SEM portal — even for SEMM (Eau de Marseille Métropole) and Vivaigo contracts. The DeviceInfo now reflects the actual utility per provider.
2. AEL_CONTEXT cookie produced invalid JSON for some users
The cookie value was built with str(dict).replace("'", '"') which:
- Corrupted any value containing an apostrophe (e.g. surname
O'Brien) - Serialised explicit
Noneas the literal string"None"
Switched to json.dumps(). None values are normalised to empty strings to match the portal's own JS encoding.
3. Diagnostics download leaked the contract id via last_exception
The "Download diagnostics" payload includes coordinator.last_exception. Internal error messages embed the request URL, which contains the contract id. The contract id is now redacted from that string (the data block already redacted it from entry.data).
4. Historical statistics import re-fetched already-imported years
_collect_new_stats walked from 2024 to the current year on every HA start, even when the recorder was up to date. Now starts from the year of the last imported timestamp; saves 2-3 API calls on every HA restart once history is in.
5. Cleanup: removed misleading constants from const.py
PORTAL_URL, PORTAL_HOST, API_BASE, APP_CLIENT_ID, APP_ACCESS_KEY, DEFAULT_HEADERS were leaked test-only artefacts that always returned the SEM endpoint regardless of the active provider. Removed; tests derive their values directly from PROVIDERS[Provider.SEM].
Tests
24 → 30 (added round-trip tests for encode_context_cookie covering apostrophe and None regressions, plus tests for the diagnostics scrub helper).
Verified
- Full local validation (ruff, mypy strict, pytest)
- All 5 CI jobs green (Lint, Typecheck, Pytest, Hassfest, HACS)
- Live smoke test on a Raspberry Pi against SEM (Ventabren contract): 5-step auth, 3 fetch endpoints, statistics import all green; the new statistics path correctly fetches only the current year (vs. 3 years previously)