Skip to content

Add support for cooling setpoint in thermostat functionality#1493

Open
liudger wants to merge 2 commits into
mainfrom
heat-cool-support
Open

Add support for cooling setpoint in thermostat functionality#1493
liudger wants to merge 2 commits into
mainfrom
heat-cool-support

Conversation

@liudger
Copy link
Copy Markdown
Owner

@liudger liudger commented May 23, 2026

  • 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.
Details

This pull request adds support for cooling setpoints to the BSBLAN Python client, enabling integration with controllers that expose a cooling comfort setpoint (parameter 902). The implementation ensures that cooling support is optional and only available on supported controllers, and updates the API, models, and tests accordingly. It also documents the new feature and provides comprehensive test coverage for the new cooling parameter.

Cooling setpoint support:

  • Added support for a cooling comfort setpoint (target_temperature_high) mapped to BSB-LAN parameter 902, including validation to ensure the parameter is only available for circuit 1 and not for unsupported controllers. ([[1]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-31bcba2ccafa41d46fbbd6d1219f7f1e3b1fb3cad9faa8e4dc521bbb579dd7b3R66-R88), [[2]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-2f3166e80717cf524a9e2c8b94ee5aa4f58038415bd28ed8cca138da80840428R1140), [[3]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-2f3166e80717cf524a9e2c8b94ee5aa4f58038415bd28ed8cca138da80840428R1151-R1159), [[4]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-2f3166e80717cf524a9e2c8b94ee5aa4f58038415bd28ed8cca138da80840428R1172-R1180), [[5]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-2f3166e80717cf524a9e2c8b94ee5aa4f58038415bd28ed8cca138da80840428R1189-R1197), [[6]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-2f3166e80717cf524a9e2c8b94ee5aa4f58038415bd28ed8cca138da80840428R1217-R1229), [[7]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-2f3166e80717cf524a9e2c8b94ee5aa4f58038415bd28ed8cca138da80840428R1250-R1259), [[8]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-0b8206ed25da1b455f42c83f9794091973c966491887a81a21517205e2f444bdR32), [[9]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-0b8206ed25da1b455f42c83f9794091973c966491887a81a21517205e2f444bdL157-R162), [[10]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-ff547c414744993d11f781199b219bc7e7fb55af32867c99467b20a5636d8afeR472))

Documentation updates:

  • Updated docs/index.md and docs/getting-started.md to describe detection and usage of the cooling setpoint, including example usage and API changes. ([[1]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-b4d68dc855d0f9476d3f2ee343853bd21bf82ea9960d0cf06661baa244439dd6R10), [[2]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-31bcba2ccafa41d46fbbd6d1219f7f1e3b1fb3cad9faa8e4dc521bbb579dd7b3R66-R88))

Test coverage:

  • Added and updated tests to verify correct mapping, validation, and behavior of the cooling setpoint, including parameter presence, value setting, error handling, and API response validation. ([[1]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-0cbb68267cd3fd9667beeb0278f8e120f7baa1f1c6b08eb9a5621540a95f776fR39-R51), [[2]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-c93ecb5bf8e16a8a6a058d01f46de5af60cf2b3ce06c57808066f2bcb6ded364R400-R417), [[3]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-85f35f24d7cc70f121d6ec00a1bcaa99af25d74a1621e0a610609fd1c40d7a3eL24-R34), [[4]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-85f35f24d7cc70f121d6ec00a1bcaa99af25d74a1621e0a610609fd1c40d7a3eR141-R149), [[5]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-5afca8e5f21c0b4ea0fdce909beeaf1b42de838e9f0543652d8584d71e1fcf7eR62-R67), [[6]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-5afca8e5f21c0b4ea0fdce909beeaf1b42de838e9f0543652d8584d71e1fcf7eL84-R154), [[7]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-aae9c379d380c9d2b3146ebb944c338e42a6641e341506cae572e6c454e2dbdeR120-R139), [[8]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-aae9c379d380c9d2b3146ebb944c338e42a6641e341506cae572e6c454e2dbdeR167-R173), [[9]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-aae9c379d380c9d2b3146ebb944c338e42a6641e341506cae572e6c454e2dbdeR221-R233))

API and constants updates:

  • Extended API configuration and parameter mappings to include the new cooling setpoint parameter, and ensured only the base parameter (902) is used, not duplicate decimals. ([[1]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-0b8206ed25da1b455f42c83f9794091973c966491887a81a21517205e2f444bdR32), [[2]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-0b8206ed25da1b455f42c83f9794091973c966491887a81a21517205e2f444bdL157-R162), [[3]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-85f35f24d7cc70f121d6ec00a1bcaa99af25d74a1621e0a610609fd1c40d7a3eL24-R34), [[4]](https://github.com/liudger/python-bsblan/pull/1493/files#diff-85f35f24d7cc70f121d6ec00a1bcaa99af25d74a1621e0a610609fd1c40d7a3eR141-R149))

Model changes:

  • Updated the State model to include target_temperature_high for reflecting the cooling setpoint in the client state. ([src/bsblan/models.pyR472](https://github.com/liudger/python-bsblan/pull/1493/files#diff-ff547c414744993d11f781199b219bc7e7fb55af32867c99467b20a5636d8afeR472))

liudger added 2 commits May 23, 2026 17:10
- 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.
Copilot AI review requested due to automatic review settings May 23, 2026 15:17
@liudger liudger added the new-feature New features or options. label May 23, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.90%. Comparing base (c61e358) to head (4bd5e65).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1493   +/-   ##
=======================================
  Coverage   99.90%   99.90%           
=======================================
  Files           6        6           
  Lines        1087     1100   +13     
  Branches      146      148    +2     
=======================================
+ Hits         1086     1099   +13     
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_high and exposed it in the State model.
  • 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.

Comment thread src/bsblan/bsblan.py
Comment on lines +1217 to +1229
if target_temperature_high is not None:
self._validate_target_temperature_high(target_temperature_high)
param_id = param_ids.get("target_temperature_high")
if param_id is None:
parameter_name = "target_temperature_high"
raise BSBLANInvalidParameterError(parameter_name)
state.update(
{
"Parameter": param_id,
"Value": str(target_temperature_high),
"Type": "1",
},
)
Comment thread src/bsblan/constants.py
Comment on lines 27 to 33
# Base parameters that exist in all API versions
BASE_HEATING_PARAMS: Final[dict[str, str]] = {
"700": "hvac_mode",
"710": "target_temperature",
"900": "hvac_mode_changeover",
"902": "target_temperature_high",
# -------
Comment thread tests/test_state.py
@@ -81,5 +87,68 @@ async def test_state(monkeypatch: Any) -> None:

# Verify API call
request_mock.assert_called_once_with(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature New features or options.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants