refactor: replace internal API client with pyodio OdioHub - #57
Open
b0bbywan wants to merge 2 commits into
Open
Conversation
Delegate all REST/SSE protocol handling to the pyodio library (hub layer): - drop api_client.py, event_stream.py, exceptions.py, coordinator.py (~1900 lines) — the hub keeps live typed state via SSE with automatic reconnection and full resync on every reconnect - entities subscribe directly to hub namespace on_change callbacks (push model, no DataUpdateCoordinator); new OdioEntity base in entity.py handles availability (hub.connected) and subscriptions - backend re-detection: hub resyncs before reporting the connection, so on_connection_change compares hub.server.backends to the setup snapshot and schedules a reload when they differ - degraded startup: connect() failure falls back to cached StartupData (now built on pyodio ServerInfo/PowerCapabilities) + hub.start() - MPRIS: raw beacon position + position_updated_at (HA extrapolates); cover URLs and x-cache-updated-at pipeline now handled by pyodio - config flow validates through the low-level OdioClient; /services 404 tolerated; helpers operate on pyodio dataclasses - tests: conftest gains a make_hub factory (real OdioHub seeded through pyodio from_dict parsers, autospec'd client) + push_event/set_connected; low-level client/SSE/upgrade-semantics suites moved to pyodio - dev deps: pyodio pinned from git (ha-parity-rc3) until a PyPI release; manifest.json intentionally unchanged for now Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016r5tpRc96W4yR2df2MjdcJ
b0bbywan
force-pushed
the
pyodio-refactor
branch
from
July 23, 2026 13:03
2ccc56a to
675aa25
Compare
Declare pyodio in the manifest now that it is published — HA installs integration requirements from PyPI — and pin the dev group to the same release instead of the git branch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016r5tpRc96W4yR2df2MjdcJ
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.
Delegate all REST/SSE protocol handling to the pyodio library (hub layer):
Claude-Session: https://claude.ai/code/session_016r5tpRc96W4yR2df2MjdcJ