Skip to content

Add support for cooling setpoint in thermostat functionality#1493

Merged
liudger merged 6 commits into
mainfrom
heat-cool-support
Jun 2, 2026
Merged

Add support for cooling setpoint in thermostat functionality#1493
liudger merged 6 commits into
mainfrom
heat-cool-support

Conversation

@liudger
Copy link
Copy Markdown
Owner

@liudger liudger commented May 23, 2026

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:

  • Added detailed documentation for temperature bounds, heating and cooling setpoints, and how cooling support is detected and used in the client (docs/getting-started.md).
  • Updated the feature list to mention detection of optional cooling setpoints and clarified API v3 support (docs/index.md).

Example Script Refactoring and Usability:

  • Refactored examples/control.py to remove unnecessary async usage 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:

  • Enhanced examples/fetch_param.py to 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:

  • Minor update in src/bsblan/bsblan.py to clean up imports and clarify API version constants.

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.91%. Comparing base (598056f) to head (5012f9d).

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.
📢 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.

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 thread src/bsblan/constants.py Outdated
Comment thread tests/test_state.py Outdated
liudger added 2 commits June 2, 2026 11:34
- 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.
@liudger liudger force-pushed the heat-cool-support branch from 4bd5e65 to b35f34f Compare June 2, 2026 09:34
liudger added 3 commits June 2, 2026 12:02
- 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.
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

Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.

Comment thread src/bsblan/bsblan.py Outdated
Comment thread tests/test_pps.py Outdated
- 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
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 2, 2026

@liudger liudger merged commit 309dbc4 into main Jun 2, 2026
16 checks passed
@liudger liudger deleted the heat-cool-support branch June 2, 2026 10:39
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

new-feature New features or options.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants