Add support for /.well-known/thread/br-rest API discovery - #271
Merged
puddly merged 2 commits intoAug 19, 2026
Conversation
Adds OTBR.get_api_version(), which reads the RFC 8615 discovery resource added in ot-br-posix PR #3330 (merged 2026-07-07) and returns the router's advertised REST API semver string (e.g. "0.3.0"), or None on routers that predate that PR. This is a first step towards feature-gating (e.g. ePSKc, see home-assistant-libs#267) on the API version instead of relying only on reactive 404 handling. Kept independent of _maybe_detect_key_format/KeyFormat: the discovery endpoint's JSON shape is unrelated to the PascalCase/camelCase dataset wire format, and this avoids touching the already well-tested detection flow.
puddly
reviewed
Aug 19, 2026
puddly
approved these changes
Aug 19, 2026
puddly
reviewed
Aug 19, 2026
- Trim the get_api_version() docstring to match the terser style used elsewhere in this module. - Replace the (_api_version, _api_version_checked) pair with a single _UndefinedType sentinel, so the attribute is an honest tristate (not-yet-probed / probed-and-absent / probed-and-known) instead of two fields that could in theory disagree. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
OTBR.get_api_version(), which reads the RFC 8615 discovery resourceGET /.well-known/thread/br-restadded in ot-br-posix PR #3330 (merged 2026-07-07)"0.3.0"), orNoneon routers that predate that PR and don't expose the endpoint (a 404 is treated as "unknown", not an error)OTBRinstanceKept independent of
_maybe_detect_key_format/KeyFormat: the discovery endpoint's JSON shape is unrelated to the PascalCase/camelCase dataset wire format, and this avoids touching the already well-tested detection flow.Why
This is a first step towards feature-gating on the REST API version instead of relying only on reactive 404 handling. In particular it's meant as a foundation for #267 (ephemeral key / ePSKc client support): once ePSKc actually lands upstream in ot-br-posix with a version bump, we'll be able to use
get_api_version()to detect support declaratively instead of only via try/except on the ePSKc endpoints. For now #267's reactive 404 detection is unaffected and remains the mechanism used for ePSKc, since the discovery resource'slinksdon't currently listba-epskc.Test plan
pytest— full suite passes (81 tests, 7 new)mypy— cleanpylint— 10/10black/flake8— clean