Merged
Conversation
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||
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.
This pull request enhances the handling and validation of device unique IDs throughout the OPNsense Home Assistant integration. The main improvement is the addition of an
expected_idparameter to theget_device_unique_idmethod, allowing the system to prefer a specific device ID if present. This change is propagated across the core integration logic, configuration flow, coordinator, and test suite to ensure consistent device identification and smoother configuration updates.Device Unique ID Handling and Validation:
custom_components/opnsense/pyopnsense/__init__.py: Updatedget_device_unique_idto accept anexpected_idparameter. If the expected ID is present among physical MAC addresses, it is returned; otherwise, the first MAC address is used.custom_components/opnsense/__init__.py,custom_components/opnsense/config_flow.py,custom_components/opnsense/coordinator.py: Propagated theexpected_idparameter through setup, validation, and coordinator logic to ensure the correct device ID is used during configuration and runtime. [1] [2] [3] [4] [5] [6] [7] [8]Test Suite Updates:
tests/conftest.py,tests/test_integration.py: Updated test client mocks to support the newexpected_idparameter inget_device_unique_id. [1] [2] [3] [4]tests/test_pyopnsense.py: Added a new test to verify thatget_device_unique_idreturns the expected ID when present, and falls back to the default when not.Code Quality Improvements:
custom_components/opnsense/coordinator.py: Improved type annotations and variable naming for clarity when dynamically invoking client methods. [1] [2]Fixes #480