Skip to content

Add minimal PPS climate support#1483

Open
liudger wants to merge 3 commits into
mainfrom
fix/pps-bus-minimal-climate
Open

Add minimal PPS climate support#1483
liudger wants to merge 3 commits into
mainfrom
fix/pps-bus-minimal-climate

Conversation

@liudger
Copy link
Copy Markdown
Owner

@liudger liudger commented May 19, 2026

This pull request adds robust support for PPS bus devices in the BSBLAN library and its control example. The changes introduce new parameter mappings, validation logic, and state normalization for PPS bus compatibility, while ensuring that device metadata is used to control feature availability (such as time sync and writable bus checks). The control example is updated to display new bus metadata and to handle PPS-specific limitations gracefully.

PPS Bus Support and Parameter Mapping:

  • Added PPS_HEATING_PARAMS and PPS_STATIC_VALUES_PARAMS to map PPS bus parameters, and updated the API config to use these when a PPS bus is detected (src/bsblan/constants.py, src/bsblan/bsblan.py). [1] [2] [3]
  • Introduced logic to detect PPS bus devices via cached device metadata and apply PPS-specific parameter handling throughout the codebase (src/bsblan/bsblan.py). [1] [2]

Validation and State Handling Improvements:

  • Implemented new validation methods to check for PPS bus write support and time sync capability, and updated circuit and HVAC mode validation to respect PPS bus constraints (src/bsblan/bsblan.py). [1] [2]
  • Normalized PPS HVAC mode values between the BSBLAN API and the library’s internal models, including bidirectional mapping and state normalization for PPS bus (src/bsblan/constants.py, src/bsblan/bsblan.py). [1] [2] [3]

Device Metadata and Feature Gating:

  • Cached device metadata after fetching, and exposed properties to check bus type, write support, and time sync support; used these properties to gate access to sensitive features (e.g., time sync, write operations) (src/bsblan/bsblan.py). [1] [2] [3] [4]

Control Example Enhancements:

  • Updated the control example to print new bus-related device metadata, format optional and boolean fields for clarity, and conditionally perform time sync operations only when supported (examples/control.py). [1] [2] [3] [4] [5]

General Refactoring and Robustness:

  • Refactored temperature unit extraction and parameter handling to be more general and robust, supporting both standard and PPS bus modes (src/bsblan/bsblan.py). [1] [2] [3] [4] [5]

These changes collectively enable seamless support for PPS bus devices, improve feature safety, and enhance the user experience in both the library and example code.

Copilot AI review requested due to automatic review settings May 19, 2026 19:30
@liudger liudger added enhancement Enhancement of the code, not introducing new features. major This PR causes a major version bump in the version number. new-feature New features or options. labels May 19, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.90%. Comparing base (5a3474f) to head (9f0a700).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1483   +/-   ##
=======================================
  Coverage   99.89%   99.90%           
=======================================
  Files           6        6           
  Lines         990     1080   +90     
  Branches      133      144   +11     
=======================================
+ Hits          989     1079   +90     
  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 adds minimal PPS bus “climate circuit” support to the python-bsblan async client by introducing PPS-specific parameter mappings, state normalization, and feature-gating based on cached /JI device metadata (bus type, write support, and time sync capability).

Changes:

  • Added PPS-specific API parameter maps (15000+ range) and HVAC-mode translation tables for PPS devices.
  • Cached device metadata in the client and used it to gate time sync and PPS write operations, plus normalized PPS HVAC mode values into the library’s State model.
  • Added comprehensive PPS-focused tests and updated the control example to display bus metadata and skip unsupported time sync.

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 PPS parameter maps and PPS HVAC mode translation constants; introduces new error messages.
src/bsblan/models.py Extends Device model with bus metadata fields and capability helper properties.
src/bsblan/bsblan.py Applies PPS-specific API config, caches device metadata, gates time sync/writes, and normalizes PPS state values.
examples/control.py Prints bus metadata and conditionally performs time sync only when supported.
tests/test_pps.py New test suite validating PPS behavior (param mapping, mode translation, time sync gating, circuit handling).
tests/test_time.py Seeds cached device metadata so time tests don’t trigger new /JI metadata fetch behavior.
tests/test_device.py Asserts new bus metadata fields and derived time sync capability.
tests/fixtures/pps_device.json PPS device metadata fixture.
tests/fixtures/pps_state.json PPS “climate” state fixture for 15000+ params.
tests/fixtures/pps_static_values.json PPS static value bounds fixture.

Comment thread src/bsblan/bsblan.py
Comment on lines 503 to 506
logger.warning(
"Could not find parameter 710 in heating section response. "
"Could not find target temperature in heating section response. "
"Using default temperature unit (°C)"
)
Comment thread src/bsblan/bsblan.py
Comment on lines +533 to +535
"""Return whether the normal BSB/LPB time sync command is safe."""
return self._device is None or self._device.supports_time_sync

Comment thread src/bsblan/bsblan.py
Comment on lines 1189 to 1194
if hvac_mode is not None:
self._validate_hvac_mode(hvac_mode)
hvac_value = str(hvac_mode)
if self._uses_pps_bus:
hvac_value = Validation.PPS_HVAC_MODE_TO_BSBLAN[hvac_mode]
state.update(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancement of the code, not introducing new features. major This PR causes a major version bump in the version number. new-feature New features or options.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants