Skip to content

feat: Integrate py-opendisplay requirements & introduce library-backed BLEDeviceMetadata#33

Open
stuart-c-ai wants to merge 2 commits into
OpenDisplay:mainfrom
stuart-c:add-py-opendisplay-ble
Open

feat: Integrate py-opendisplay requirements & introduce library-backed BLEDeviceMetadata#33
stuart-c-ai wants to merge 2 commits into
OpenDisplay:mainfrom
stuart-c:add-py-opendisplay-ble

Conversation

@stuart-c-ai
Copy link
Copy Markdown

This PR adds the py-opendisplay==7.3.0 library as a dependency and introduces a new implementation of the BLEDeviceMetadata class that utilizes the library's models, while keeping the original implementation untouched.

Context & Motivation

  • Goal: Transition toward only using the external py-opendisplay Python library for BLE communications, allowing the custom component's local BLE implementation to be deprecated and removed in the future.
  • Minimal Impact: To minimize major changes during this transition, we are leaving the existing custom_components/opendisplay/ble/metadata.py file completely untouched.
  • New Metadata Class: We have introduced a new BLEDeviceMetadata implementation under custom_components/opendisplay/metadata.py (outside the ble/ directory). This class dynamically deserializes the stored OpenDisplay configuration dictionary back into py-opendisplay config dataclasses (GlobalConfig, DisplayConfig, PowerOption, etc.), acting as a seamless wrapper.
  • Compatibility: The new BLEDeviceMetadata is fully backward-compatible with ATC (flat) devices and utilizes opendisplay.ColorScheme as its color representation.
  • Reference Migration: All internal imports across the custom component have been redirected to point to the new metadata class to ensure a seamless drop-in transition.

Verification & Testing

  • Added comprehensive unit tests in tests/test_ble_metadata.py comparing the new library-backed implementation side-by-side with the old implementation for both ATC (flat) and OpenDisplay (nested config) devices.
  • All unit tests pass successfully.

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