fix(number): 🩹 correct off-by-one in dhw manual frequency mapping#676
Merged
Conversation
- 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
Contributor
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.
🐛 Bug
The
number.luxtronik_..._dhw_manual_frequencyentity 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
FrequencyAutomaticraw-to-Hz conversion from+19/-19(raw 1-101 → 20-120 Hz) to+20/-20(raw 1-101 → 21-121 Hz), and bumpednative_max_valueto 121 to match — but the heat pump's real range is 20-120 Hz.✅ Fix
lux_overrides.py: revertFrequencyAutomatic.from_heatpump/to_heatpumpto the correct 20-120 Hz mappingnumber_entities_predefined.py: revertnative_max_valuefrom121.0to120.0number.py: revert theasync_set_native_valuevalidation threshold from0 < value < 21to0 < value < 20so 20 Hz is a valid manual value againtest_lux_overrides.pyandtest_number.pyto assert the corrected 20-120 Hz rangePer discussion on #674, the
+20/121mapping 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_frequencyin 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 reportspump_frequencyrelative 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 passedruff check/ruff format --check— cleanbasedpyright— 0 errorsResolves #674