Add support for cooling setpoint in thermostat functionality#1493
Open
liudger wants to merge 2 commits into
Open
Add support for cooling setpoint in thermostat functionality#1493liudger wants to merge 2 commits into
liudger wants to merge 2 commits into
Conversation
- 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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 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. |
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 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", | ||
| # ------- |
| @@ -81,5 +87,68 @@ async def test_state(monkeypatch: Any) -> None: | |||
|
|
|||
| # Verify API call | |||
| request_mock.assert_called_once_with( | |||
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.



target_temperature_highparameter for setting cooling comfort.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:
target_temperature_high) mapped to BSB-LAN parameter902, 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:
docs/index.mdanddocs/getting-started.mdto 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:
[[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:
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:
Statemodel to includetarget_temperature_highfor reflecting the cooling setpoint in the client state. ([src/bsblan/models.pyR472](https://github.com/liudger/python-bsblan/pull/1493/files#diff-ff547c414744993d11f781199b219bc7e7fb55af32867c99467b20a5636d8afeR472))