Skip to content

cleanup: Remove deprecated ble/ directory and streamline test suite#37

Open
stuart-c-ai wants to merge 6 commits into
OpenDisplay:mainfrom
stuart-c:tidy-ble-cleanup
Open

cleanup: Remove deprecated ble/ directory and streamline test suite#37
stuart-c-ai wants to merge 6 commits into
OpenDisplay:mainfrom
stuart-c:tidy-ble-cleanup

Conversation

@stuart-c-ai
Copy link
Copy Markdown

Stacked PR Dependency

Important

This Pull Request represents Stage 4 (the final stage) of our sequential migration to the new py-opendisplay BLE library. It depends on and includes the changes from Stage 3.

Please ensure that PR #36: refactor: Port image upload pipelines to py-opendisplay client is merged before this PR is reviewed or merged.


Description & Goal

This PR completes the py-opendisplay BLE migration by performing final tidy-up and code cleanup. It completely removes the entire deprecated custom_components/opendisplay/ble/ folder containing the old BLE protocol engine, custom connection managers, exceptions, image processors, and parsers, which have been fully superseded by py-opendisplay. Additionally, this PR streamlines our unit test suite to verify the new BLEDeviceMetadata implementation standalone.

With this PR merged, the migration is complete, leaving the integration extremely clean, robust, and aligned with standard library APIs.


What was Done & Why

1. Pruning 3,721 Lines of Deprecated BLE Stack Code

  • Directory: custom_components/opendisplay/ble/
  • What: Completely deleted the ble/ directory and all 13 Python files inside it, including:
    • __init__.py, color_scheme.py, connection.py, exceptions.py, image_processing.py, image_upload.py, metadata.py, operations.py, protocol_atc.py, protocol_base.py, protocol_factory.py, protocol_open_display.py, and tlv_parser.py.
  • Why: Since connection tracking, command operations, and image upload pipelines have been fully ported to the py-opendisplay library, this legacy custom engine is completely obsolete. Removing it reduces integration codebase bloat.

2. Streamlining the Unit Test Suite

  • File: tests/test_ble_metadata.py
  • What: Cleaned up the test suite to remove all references, imports, and comparative logic targeting OldBLEDeviceMetadata. Removed local sys.path adjustments that pointed to the deleted ble/ directory.
  • Why: To test the new BLEDeviceMetadata implementation standalone and prevent import errors due to the deletion of the legacy ble/ folder.

3. Standalone Test Verification

  • What: Verified that the test suite compiles and runs correctly standalone:
    PYTHONPATH=. ./venv/bin/pytest tests/test_ble_metadata.py
    All tests passed without any errors or warnings.
  • Why: Confirms that the integration's metadata parsing remains fully robust and functional after pruning the legacy code.

@stuart-c-ai stuart-c-ai requested a review from g4bri3lDev as a code owner May 25, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants