Add support for cooling setpoint in thermostat functionality#1493
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1493 +/- ##
=======================================
Coverage 99.90% 99.91%
=======================================
Files 6 6
Lines 1087 1116 +29
Branches 146 152 +6
=======================================
+ Hits 1086 1115 +29
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the python-bsblan async client to expose an optional “cooling comfort” setpoint for heating circuit 1 by mapping BSB-LAN parameter 902 to a new State.target_temperature_high field and allowing it to be written via BSBLAN.thermostat().
Changes:
- Added parameter mapping for
902 -> target_temperature_highand exposed it in theStatemodel. - Extended thermostat write support to allow setting
target_temperature_high(HC1 only) while preserving the one-parameter-per-call restriction. - Updated docs and added/updated tests + fixtures to cover reading, writing, and validation behavior for the new parameter.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/bsblan/constants.py |
Adds the 902 parameter mapping and makes it available for thermostat writes on circuit 1. |
src/bsblan/models.py |
Adds target_temperature_high to the State model. |
src/bsblan/bsblan.py |
Extends thermostat() and state preparation to validate and write target_temperature_high. |
tests/test_thermostat.py |
Adds tests for writing target_temperature_high and multi-parameter rejection. |
tests/test_state.py |
Adds assertions and new tests for reading target_temperature_high and validation stripping. |
tests/test_constants.py |
Updates expected API parameter sets and verifies 902 is used without decimal variants. |
tests/test_circuit.py |
Adds a circuit-2 rejection test for cooling setpoint writes. |
tests/fixtures/state.json |
Adds fixture data for parameter 902. |
docs/index.md |
Mentions optional cooling setpoint detection in feature list. |
docs/getting-started.md |
Documents cooling setpoint support, detection, and usage guidance. |
- Introduced `target_temperature_high` parameter for setting cooling comfort. - Updated relevant constants and models to accommodate new parameter. - Enhanced tests to validate cooling temperature handling and constraints.
4bd5e65 to
b35f34f
Compare
- Require BSB-LAN API v3 (firmware >= 3.0.0); remove v1 config and version branching, raising BSBLANVersionError for unsupported firmware - Add cooling setpoint bounds to StaticState (heating_protective_setpoint, cooling_comfort_setpoint_min, cooling_reduced_setpoint) and map params for HC1 (905/903) and HC2 (1205/1203) - Validate target_temperature_high against cooling bounds and fail fast on buses without a cooling setpoint parameter - Track available circuits to skip temperature-range fetches for unavailable circuits - Update fixtures, tests, and docs for the v3-only parameter set
Add --structure (/JC) to dump parameter structure incl. data type, read/write flag, unit and enum possibleValues, and --category (/JK) to dump all parameters of a category. Default value query (/JQ) unchanged.
Make get_attribute and the print helpers synchronous (they no longer await), reduce repetition, and show cooling details: mode changeover, heating/cooling setpoints in device state and separate heating/cooling bounds in static state.
- Raise BSBLANVersionError instead of crashing when firmware strings are not PEP 440 compliant (InvalidVersion); add a regression test - Remove a duplicate _available_circuits assertion in test_pps - Use assert_awaited_once_with for the AsyncMock request in test_state
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.



This pull request introduces several documentation improvements, code refactorings, and feature enhancements to support cooling setpoints and simplify the example scripts. The main changes include expanded documentation for temperature and cooling support, a significant refactor of the example scripts to remove unnecessary async usage, and improved parameter fetching capabilities.
Documentation and Feature Enhancements:
docs/getting-started.md).docs/index.md).Example Script Refactoring and Usability:
examples/control.pyto remove unnecessaryasyncusage in printing functions, simplifying the code and making it easier to read and maintain. Also expanded the static state printout to include cooling bounds and improved hot water configuration display. [1] [2] [3] [4] [5] [6] [7] [8]Parameter Fetching Improvements:
examples/fetch_param.pyto support fetching parameter structure (/JC) and category dumps (/JK), improved CLI argument parsing, and added pretty-printing for API responses. The script now provides clearer instructions and more flexible usage. [1] [2] [3]Internal Codebase Maintenance:
src/bsblan/bsblan.pyto clean up imports and clarify API version constants.