fix: keep auto-mode setpoint band on the unit grid (Celsius) - #226
Draft
bluetoothbot wants to merge 2 commits into
Draft
fix: keep auto-mode setpoint band on the unit grid (Celsius)#226bluetoothbot wants to merge 2 commits into
bluetoothbot wants to merge 2 commits into
Conversation
set_heat_cool_temp's auto/off-mode branch split the deadband with math.ceil(deadband / 2), forcing an integer half-offset. On Celsius systems this over-widened the band off the 0.5 grid: a 1.0 deadband yielded +/-1.0 instead of the minimal +/-0.5. Round the half-deadband up to the unit's grid step (0.5 C, 1 F) instead. Fahrenheit output is unchanged. Adds coverage for the previously untested branch.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
What: Keep the auto-mode setpoint band aligned to the temperature unit's grid when expanding a single
set_temperatureinto heat/cool setpoints.Why:
set_heat_cool_temp's auto/off-mode branch split the deadband withmath.ceil(deadband / 2), forcing a whole-degree half-offset. On Celsius systems (0.5° grid) this over-widened the band: a 1.0° deadband produced a ±1.0° band (gap 2.0°) instead of the minimal ±0.5° (gap 1.0°). Sincepy.typedshipped (#203), Celsius fractional precision is a real downstream contract — the read/write setpoint paths were widened tofloatin #205/#206, and this is the matching rounding fix.How: Round the half-deadband up to the unit's grid step (0.5° Celsius, 1° Fahrenheit) rather than to an integer. The band still satisfies the deadband, but is the minimal grid-aligned spread. Fahrenheit output is provably unchanged (
ceil(d/2/1)*1 == ceil(d/2)).Testing: Added two cases for the previously untested auto-mode branch — Fahrenheit (deadband 3 → ±2°, regression guard) and Celsius (deadband 1.0 → ±0.5° on the half-degree grid). Full suite 59 passed, ruff + mypy clean.
Quality Report
Changes: 2 files changed, 64 insertions(+), 5 deletions(-)
Code scan: clean
Tests: passed (59 passed)
Branch hygiene: clean
Generated by Kōan