Release 0.1.1: fix phantom hot water tank (upstream #12), clear error for unsupported operations (#10) #2

Merged
tim merged 2 commits from fix/unit-detection into main 2026-10-12 12:48:27 +00:00
Owner

Fixes two upstream issues that are real bugs. Upstream has no open PRs, and every merged PR is already in our fork.

Upstream issue #12: every unit was a hot water tank

elif label == "function/DomesticHotWaterTank" or "function/DomesticHotWater":

is always true (a non-empty string), so every unit that was not space heating became a water tank controller, and the function/Adapter branch after it could never run. On a hydrobox without a tank (EHYHBH08AAV3), the adapter was reported as hot_water_tank with every field None. In the Home Assistant integration that was a phantom Hot Water Tank device (sw_version "None/None") that could not be deleted. It is now a membership test, so hot_water_tank is None when there is no tank.

Upstream issue #10: bare KeyError

call_operation indexed the unit's operation config directly, so an operation the unit does not expose raised KeyError. It now raises AlthermaException("Operation X is not supported by unit N") and sends nothing.

Tests

Written first, five failed on the old code: discovery for space heating, both tank labels, the adapter, a hydrobox without a tank, an unrecognized unit; and supported/unsupported operations. 41 tests pass (coverage 65% to 75%), ruff and bandit clean.

Not changed

  • Upstream #11 (a device reporting settable: false still receives the write, with a warning): this is how the library has always behaved and the reporter confirms the write works. Not a library bug.
  • #13, #9, #8, #5 are feature requests or questions.

After merging

auto-tag creates v0.1.1. Then the Home Assistant integration needs its pin bumped to v0.1.1, and the platforms must cope with hot_water_tank being None (separate MR, in preparation).

Claude-Session: https://claude.ai/code/session_013jL41LP9srdcUDYggNpC98

🤖 Generated with Claude Code

Fixes two upstream issues that are real bugs. Upstream has no open PRs, and every merged PR is already in our fork. ## Upstream issue #12: every unit was a hot water tank ```python elif label == "function/DomesticHotWaterTank" or "function/DomesticHotWater": ``` is always true (a non-empty string), so every unit that was not space heating became a water tank controller, and the `function/Adapter` branch after it could never run. On a hydrobox without a tank (`EHYHBH08AAV3`), the adapter was reported as `hot_water_tank` with every field `None`. In the Home Assistant integration that was a **phantom Hot Water Tank device** (`sw_version "None/None"`) that could not be deleted. It is now a membership test, so `hot_water_tank` is `None` when there is no tank. ## Upstream issue #10: bare KeyError `call_operation` indexed the unit's operation config directly, so an operation the unit does not expose raised `KeyError`. It now raises `AlthermaException("Operation X is not supported by unit N")` and sends nothing. ## Tests Written first, five failed on the old code: discovery for space heating, both tank labels, the adapter, a hydrobox without a tank, an unrecognized unit; and supported/unsupported operations. 41 tests pass (coverage 65% to 75%), ruff and bandit clean. ## Not changed - Upstream #11 (a device reporting `settable: false` still receives the write, with a warning): this is how the library has always behaved and the reporter confirms the write works. Not a library bug. - #13, #9, #8, #5 are feature requests or questions. ## After merging `auto-tag` creates `v0.1.1`. Then the Home Assistant integration needs its pin bumped to `v0.1.1`, and the platforms must cope with `hot_water_tank` being `None` (separate MR, in preparation). Claude-Session: https://claude.ai/code/session_013jL41LP9srdcUDYggNpC98 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Upstream issue #12: the unit-type dispatch used

    elif label == "function/DomesticHotWaterTank" or "function/DomesticHotWater":

which is always true (a non-empty string). Every unit that was not space
heating became a water tank controller, and the "function/Adapter" branch
after it could never run. On a hydrobox without a tank, the adapter was
reported as hot_water_tank with every field None, which showed up in the
Home Assistant integration as a phantom Hot Water Tank device. Use a
membership test.

Upstream issue #10: call_operation indexed the unit's operation config
directly, so an operation the unit does not expose raised a bare
KeyError after nothing was sent. Raise AlthermaException naming the
operation and the unit instead.

Tests first (five failed on the old code): discovery for space heating,
tank and plain-water labels, the adapter, a hydrobox without a tank, an
unrecognized unit, and supported/unsupported operations.
41 tests pass, coverage 65% -> 75%.

Not changed: upstream issue #11 (a device that reports settable=false
still gets the write and a warning); that is how the library has always
behaved and the reporter confirms the write works.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jL41LP9srdcUDYggNpC98
chore: release 0.1.1
All checks were successful
Security / Security scan (pull_request) Successful in 34s
Test / Lint and test (pull_request) Successful in 17s
b3e0005c26
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jL41LP9srdcUDYggNpC98
tim merged commit 3e706a964f into main 2026-10-12 12:48:27 +00:00
tim deleted branch fix/unit-detection 2026-10-12 12:48:27 +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
tim/pyaltherma!2
No description provided.