Skip to content

Conversation

@liudger
Copy link
Owner

@liudger liudger commented Jan 10, 2026

This pull request adds a set of low-level parameter access methods to the BSBLAN client, enabling more granular and efficient retrieval of device parameters by ID or name. It also introduces comprehensive tests for these new methods and improves error handling for parameter access.

Key changes include:

New low-level parameter access methods in BSBLAN:

  • Added read_parameters to fetch specific parameters by their BSB-LAN parameter IDs, returning a dictionary of EntityInfo objects keyed by parameter ID. Raises a clear error if no IDs are provided.
  • Added get_parameter_id and get_parameter_ids to look up parameter IDs by name, supporting both single and multiple lookups.
  • Added read_parameters_by_name, a convenience method to fetch parameters by their names, handling name-to-ID resolution and error cases such as missing names or uninitialized API data.

Error handling improvements:

  • Introduced new error messages in constants.py for missing parameter IDs, missing parameter names, and unresolved parameter names, and integrated them into the new methods. [1] [2]

Testing:

  • Added a new test module test_read_parameters.py with extensive tests covering all new parameter access methods, including edge cases and error conditions.

Type and import updates:

  • Updated imports in bsblan.py to include EntityInfo and new error messages. [1] [2]

These changes provide a more flexible and robust interface for parameter access, making it easier to interact with BSB-LAN devices at a low level while ensuring reliability and clear error reporting.

Copilot AI review requested due to automatic review settings January 10, 2026 15:49
@liudger liudger added enhancement Enhancement of the code, not introducing new features. new-feature New features or options. labels Jan 10, 2026
Copy link
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 pull request adds low-level parameter access methods to the BSBLAN client, enabling granular and efficient parameter retrieval by ID or name. The implementation follows existing codebase patterns, includes comprehensive error handling, and is fully covered by tests.

Changes:

  • Added four new methods to BSBLAN class: read_parameters, get_parameter_id, get_parameter_ids, and read_parameters_by_name for flexible parameter access
  • Introduced three new error message constants in constants.py for clear error reporting in parameter access scenarios
  • Added comprehensive test suite test_read_parameters.py with 11 test cases covering success paths, error conditions, and edge cases

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/bsblan/bsblan.py Adds four new low-level parameter access methods with proper type hints, documentation, error handling, and import updates for EntityInfo and new error messages
src/bsblan/constants.py Defines three new error message constants for parameter access validation
tests/test_read_parameters.py Comprehensive test coverage with 11 tests covering all new methods, including empty lists, missing data, invalid data, and API initialization edge cases

@codecov
Copy link

codecov bot commented Jan 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.88%. Comparing base (70ae6fe) to head (f22c34e).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1309   +/-   ##
=======================================
  Coverage   99.87%   99.88%           
=======================================
  Files           6        6           
  Lines         827      872   +45     
  Branches      102      115   +13     
=======================================
+ Hits          826      871   +45     
  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

@liudger liudger merged commit 83c2712 into main Jan 10, 2026
17 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement Enhancement of the code, not introducing new features. new-feature New features or options.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants