Skip to content

fix(number): 🩹 correct off-by-one in dhw manual frequency mapping#676

Merged
rhammen merged 2 commits into
mainfrom
fix/dhw-manual-frequency-mapping
Jul 5, 2026
Merged

fix(number): 🩹 correct off-by-one in dhw manual frequency mapping#676
rhammen merged 2 commits into
mainfrom
fix/dhw-manual-frequency-mapping

Conversation

@rhammen

@rhammen rhammen commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

🐛 Bug

The number.luxtronik_..._dhw_manual_frequency entity displayed/wrote values 1 Hz higher than the heat pump's real manual DHW frequency (reported in #674).
E.g. the heat pump GUI shows 54 Hz while the HA entity showed 55 Hz.

Root cause: da00b30 changed the FrequencyAutomatic raw-to-Hz conversion from +19/-19 (raw 1-101 → 20-120 Hz) to +20/-20 (raw 1-101 → 21-121 Hz), and bumped native_max_value to 121 to match — but the heat pump's real range is 20-120 Hz.

✅ Fix

  • lux_overrides.py: revert FrequencyAutomatic.from_heatpump/to_heatpump to the correct 20-120 Hz mapping
  • number_entities_predefined.py: revert native_max_value from 121.0 to 120.0
  • number.py: revert the async_set_native_value validation threshold from 0 < value < 21 to 0 < value < 20 so 20 Hz is a valid manual value again
  • Updated affected unit tests in test_lux_overrides.py and test_number.py to assert the corrected 20-120 Hz range

⚠️ Known caveat

Per discussion on #674, the +20/121 mapping this PR reverts was originally introduced because of a separate observation: when the heat pump was set to a fixed DHW frequency of 30 Hz via its own controller, sensor.luxtronik2_pump_frequency in HA continuously reported 29 Hz — i.e. 1 Hz below the value actually configured on the unit.

This PR restores the entity's display/write range to match the heat pump's documented 20-120 Hz UI range (fixing the reported bug), but as a result the actual pump frequency may run 1 Hz lower than the value set via dhw_manual_frequency. That discrepancy appears to be a separate, pre-existing quirk in how the heat pump reports pump_frequency relative to a fixed DHW setpoint, not something this mapping fix can address without reintroducing the original off-by-one display bug. Tracking/investigating that separately may be worthwhile, but is out of scope here.

Test plan

  • pytest — 747 passed
  • ruff check / ruff format --check — clean
  • basedpyright — 0 errors

Resolves #674

- revert FrequencyAutomatic raw-to-Hz mapping from 21-121 Hz back to 20-120 Hz
- revert native_max_value for dhw_manual_frequency from 121 to 120
- revert async_set_native_value validation threshold from 21 to 20
- update affected unit tests to match the corrected 20-120 Hz range

Resolves #674
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
custom_components.luxtronik2 100%
Summary 100% (2873 / 2874)

@rhammen rhammen merged commit 9ffae27 into main Jul 5, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong mapping dhw_manual_frequency

1 participant