-
Notifications
You must be signed in to change notification settings - Fork 2
Add low-level parameter access methods #1309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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
BSBLANclass:read_parameters,get_parameter_id,get_parameter_ids, andread_parameters_by_namefor flexible parameter access - Introduced three new error message constants in
constants.pyfor clear error reporting in parameter access scenarios - Added comprehensive test suite
test_read_parameters.pywith 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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|



This pull request adds a set of low-level parameter access methods to the
BSBLANclient, 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:read_parametersto fetch specific parameters by their BSB-LAN parameter IDs, returning a dictionary ofEntityInfoobjects keyed by parameter ID. Raises a clear error if no IDs are provided.get_parameter_idandget_parameter_idsto look up parameter IDs by name, supporting both single and multiple lookups.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:
constants.pyfor missing parameter IDs, missing parameter names, and unresolved parameter names, and integrated them into the new methods. [1] [2]Testing:
test_read_parameters.pywith extensive tests covering all new parameter access methods, including edge cases and error conditions.Type and import updates:
bsblan.pyto includeEntityInfoand 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.