Fix thermostat min-temp regression and clarify setpoint names#1503
Conversation
…bound Param 712 (Room temp reduced setpoint, ~17 °C) was mapped to 'min_temp' which Home Assistant uses as the climate slider minimum. The actual lower bound is param 714 (frost-protection / heating protective setpoint, ~8 °C). Changes: - Rename '712' -> 'temp_reduced_setpoint' and '1012' -> 'temp_reduced_setpoint' in BASE_STATIC_VALUES_PARAMS / BASE_STATIC_VALUES_CIRCUIT2_PARAMS - Add temp_reduced_setpoint field to StaticState; keep min_temp for PPS circuits that expose 15006 as their only lower bound - _fetch_temperature_range: prefer heating_protective_setpoint (714/1014) as temp_range['min']; fall back to min_temp for PPS buses - Update tests, fixtures, and control example
Param 716/1016 is the comfort setpoint maximum, not a generic max temperature. Rename it to comfort_setpoint_max for clarity and source the circuit max bound from it, falling back to max_temp for PPS circuits (15007). PPS keeps min_temp/max_temp (15006/15007) unchanged.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1503 +/- ##
=======================================
Coverage 99.91% 99.91%
=======================================
Files 6 6
Lines 1116 1120 +4
Branches 152 152
=======================================
+ Hits 1115 1119 +4
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR refactors how static heating temperature setpoints are represented and mapped, introducing clearer names for reduced and comfort-max setpoints and updating temperature-range initialization to prefer protective/comfort bounds over legacy min/max fields.
Changes:
- Renames static setpoint mappings:
712/1012 → temp_reduced_setpointand716/1016 → comfort_setpoint_maxacross config, fixtures, and tests. - Updates
_fetch_temperature_rangeto useheating_protective_setpointas the preferred lower bound andcomfort_setpoint_maxas the preferred upper bound, with PPS fallbacks. - Adjusts tests and example output to reflect the new attribute names and updated min-bound logic.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/bsblan/models.py |
Adds new StaticState fields for reduced and comfort-max setpoints. |
src/bsblan/constants.py |
Updates parameter→attribute mappings for staticValues (both circuits). |
src/bsblan/bsblan.py |
Refines temperature range derivation to prefer protective/comfort bounds. |
examples/control.py |
Updates printed static-state labels/attributes to new setpoint names. |
tests/test_constants.py |
Updates mapping assertions for renamed static setpoints. |
tests/test_static_state.py |
Updates expectations to new StaticState attribute names. |
tests/test_circuit.py |
Updates temperature-range initialization expectations (min now protective). |
tests/test_temperature_validation.py |
Updates mocks/coverage for missing bound scenarios under new logic. |
tests/test_include_parameter.py |
Updates include-based staticValues fetch to use new attribute name. |
tests/test_utility_additional.py |
Updates APIValidator config fixture for renamed static values. |
tests/fixtures/dict_version.json |
Updates fixture mapping keys for renamed static setpoints. |
Comments suppressed due to low confidence (1)
tests/test_temperature_validation.py:162
- This mock sets
max_tempbut does not setcomfort_setpoint_max. Since the production code now preferscomfort_setpoint_max, an unconfigured AsyncMock may create a truthycomfort_setpoint_maxattribute implicitly, causing the test to populatemaxwith a Mock instead of falling back tomax_temp. Explicitly setcomfort_setpoint_max = Nonehere to keep the test aligned with the new selection logic.
static_values_mock.return_value.heating_protective_setpoint = None
static_values_mock.return_value.min_temp = None
static_values_mock.return_value.max_temp = AsyncMock()
static_values_mock.return_value.max_temp.value = "30"
monkeypatch.setattr(client, "static_values", static_values_mock)
- Fix StaticState field comments (min_temp/max_temp are PPS-only; 714/1014 and 716/1016 map to protective/comfort setpoints) - Make temp-range source selection skip inactive values (value=None) so it falls back correctly when a setpoint returns '---' - Pick example Temperature Unit from first available attribute - Relabel example 'Max Temperature' to 'Comfort Setpoint Max' - Set mock setpoint attrs explicitly for deterministic tests
|



This pull request refactors the handling of static temperature setpoints and their mapping throughout the codebase, clarifying the distinction between reduced (eco/night), comfort, and protective setpoints. The changes update internal models, API mappings, and tests to use more precise attribute names and logic for determining temperature bounds, improving maintainability and correctness.
Refactoring of static temperature setpoint attributes:
StaticStatemodel to addtemp_reduced_setpointandcomfort_setpoint_maxattributes, clarifying their meaning and use, while keepingmin_tempandmax_tempfor legacy/PPS support.temp_reduced_setpoint(wasmin_temp) andcomfort_setpoint_max(wasmax_temp) for both circuits, ensuring consistent naming throughout. [1] [2] [3] [4] [5]Temperature range calculation logic improvements:
_fetch_temperature_rangeto preferheating_protective_setpointas the lower bound andcomfort_setpoint_maxas the upper bound, falling back tomin_temp/max_temponly for PPS circuits.Test updates for new attribute names and logic:
temp_reduced_setpointandcomfort_setpoint_maxinstead ofmin_tempandmax_temp, and updated expected values to reflect the new lower bound logic (e.g., using the protective setpoint as min). [1] [2] [3] [4] [5] [6]User-facing output updates:
print_static_stateto display the new setpoint names and pull the temperature unit from the correct attribute. [1] [2]