Skip to content

Conversation

@lboue
Copy link

@lboue lboue commented Jan 7, 2026

Description:

This pull request adds a new get_diagnostics() method to the OTBR class that retrieves the diagnostics collection from the Open Thread Border Router REST API.
The goal is to make diag data accessible to the back office to facilitate diagnosis.

Changes

  • Added get_diagnostics() method that:
    • Calls the /api/diagnostics endpoint via a GET request
    • Returns the diagnostics data as a dictionary, or None if no diagnostics data is available
    • Properly handles HTTP error statuses by raising OTBRError for non-200 responses
    • Handles JSON parsing errors gracefully

Implementation Details

  • Follows the same pattern as existing methods in the OTBR class (e.g., get_coprocessor_version())
  • Uses the configured timeout from the instance
  • Returns None for HTTP 204 (NO_CONTENT) responses, consistent with other methods
  • Includes comprehensive docstring documenting return value and exception handling

API Reference

Based on the OpenAPI specification: https://github.com/openthread/ot-br-posix/blob/main/src/rest/openapi.yaml

@lboue lboue marked this pull request as ready for review January 7, 2026 21:51
@emontnemery
Copy link
Collaborator

Please fix the lint error 👍

@emontnemery
Copy link
Collaborator

emontnemery commented Jan 8, 2026

@lboue do you plan to make use of this feature in Home Assistant core? Is this feature supported by the hassio OTBR add-on?

@lboue
Copy link
Author

lboue commented Jan 8, 2026

@lboue do you plan to make use of this feature in Home Assistant core? Is this feature supported by the hassio OTBR add-on?

Yes, the goal is to make diag data accessible to the back office to facilitate diagnosis.
For the moment, I haven't modified the other components.

How can I compile a dev version of the obtr addon that includes this modification in order to test it? A little help on this subject would be appreciated.

@emontnemery
Copy link
Collaborator

How can I compile a dev version of the obtr addon that includes this modification in order to test it? A little help on this subject would be appreciated.

@agners can answer that, but he's unavailable for a couple of weeks. I suggest to set this PR to draft until it's been tested with an OTBR addon which supports diagnostics.

@emontnemery emontnemery marked this pull request as draft January 8, 2026 10:02
@lboue
Copy link
Author

lboue commented Jan 8, 2026

OK

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