Repository navigation
Conversation
Replace the external `aquanta==0.2` dependency with an in-repo api.py that is interface-compatible with it, so __init__/coordinator/entity need only an import swap. The vendored client adds: - Token lifecycle: Firebase refresh + automatic re-auth on HTTP 401, fixing the failure mode where the integration dies on every poll once the session token expires and only recovers on reload. - Setpoint and operation-mode writes via PATCH /v2/devices/advanced (the pip client had no temperature/mode control at all). Endpoint + batch body shape verified live. - Per-call errors raised as RuntimeError (what the integration already catches). water_heater.py now advertises TARGET_TEMPERATURE and OPERATION_MODE in addition to AWAY_MODE; current_operation/target_temperature derive from the `advanced` flags. setPoint and water.temperature are degC (confirmed from app source: Ju(...,"degC") both directions), so temperature_unit CELSIUS is correct. Reconstructed from the Aquanta Android app v2.11.1 and cross-checked against aquanta==0.2. Auth, reads, and the setpoint write are verified live. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- API: typed connection/auth errors; persistent 401 -> auth error (reauth); GET rejects empty/non-JSON bodies; close session on failed login; refresh only re-logs-in on a rejected token; drop dead token-expiry field. - Setup: close the session and avoid a stale coordinator when the first refresh fails; drop the needless options-change reload (away duration is read live). - Coordinator: rely on per-request timeouts; map auth vs update failures. - Entities: wrap Away/Boost writes as HomeAssistantError; guard all partial cloud data (no KeyErrors); report unknown (not off) when data is missing. - water_heater: honour operation_mode in set_temperature; remove unused import. - config_flow: complete the reauth flow; normalise unique_id; coerce the away-duration option to int. - Packaging: align HA version floor (2024.4) across hacs.json/requirements; ruff target py312; fix translation key parity; restore .gitignore; stop tracking the built aquanta.zip. - tests: add the missing fixtures, a manager-based setup/reload test, and unit tests for the API client.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The integration depends on the
aquantaPyPI package, which has a couple of limitations I kept running into. It logs in once and never refreshes the token, so after the session expires every poll fails until you reload the integration. It also only does Away/Boost — no way to set the target temperature or change the operating mode.This pulls the client into the repo as
api.py, keeping the same interface the old package exposed so the rest of the integration barely changes, and fixes both:set_temperatureand operation-mode selection (eco/intelligence, thermostat, timer, time-of-use, off) to the water heater.A few notes:
api.aquanta.io/v2, Firebase email/password).setPointand the tank temperature are both in °C, so the entity stays Celsius.aquanta==0.2requirement from the manifest now that the client is vendored.Happy to adjust anything.