Skip to content

Add Thread credential sharing to the Thread panel - #53330

Open
Poshy163 wants to merge 12 commits into
home-assistant:devfrom
Poshy163:otbr-thread-credential-sharing
Open

Add Thread credential sharing to the Thread panel#53330
Poshy163 wants to merge 12 commits into
home-assistant:devfrom
Poshy163:otbr-thread-credential-sharing

Conversation

@Poshy163

@Poshy163 Poshy163 commented Jul 27, 2026

Copy link
Copy Markdown

Proposed change

Add a button to the network card which asks the border router for a Thread Administration Passcode and shows it, with a QR code, so another border router can be given temporary access to the Thread network.

Video

ePSKc.mp4

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • I have followed the perfect PR recommendations
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

To help with the load of incoming pull requests:

Add a button to the network card which asks the border router for a
Thread Administration Passcode and shows it, with a QR code, so another
border router can be given temporary access to the Thread network.

Needs the otbr/create_ephemeral_key websocket command from core.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds UI support in the Thread configuration panel to request a Thread Administration Passcode (ephemeral key / ePSKc) from a border router and present it as both a manual code and QR code for credential sharing with another border router.

Changes:

  • Add a “Share network credentials” action to the Thread network card, selecting a compatible border router when available.
  • Introduce a new dialog to display the generated passcode and QR code, and revoke the ephemeral key when the dialog is closed.
  • Extend OTBR frontend data layer with WebSocket helpers and types for creating/deleting ephemeral keys, plus new localization strings.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/translations/en.json Adds new localized strings for the credential sharing action, dialog, and error states.
src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts Adds the QR/share icon button and the handler that calls the OTBR WebSocket command and opens the new dialog.
src/panels/config/integrations/integration-panels/thread/show-dialog-thread-ephemeral-key.ts Adds the dialog launcher (show-dialog fireEvent wrapper) for the new dialog.
src/panels/config/integrations/integration-panels/thread/dialog-thread-ephemeral-key.ts Implements the dialog UI to show the passcode + QR code and revoke the ephemeral key on close.
src/data/otbr.ts Adds OTBR ephemeral key WebSocket APIs and extends OTBRInfo with ephemeral_key_supported.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/translations/en.json Outdated
Comment on lines +487 to +491
title: this.hass.localize(
"ui.panel.config.thread.share_credentials_failed"
),
text: err.message,
});
@Poshy163

Poshy163 commented Aug 22, 2026

Copy link
Copy Markdown
Author

The above is to stop this from occurring

image

(now looks like this)

image

@Poshy163
Poshy163 marked this pull request as ready for review August 22, 2026 13:02
@github-actions github-actions Bot added the Needs Template PR description does not follow the pull request template label Aug 22, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Template PR description does not follow the pull request template label Aug 22, 2026
Comment thread src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts Outdated

@MindFreeze MindFreeze left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DialogMixin removes the element on close but keeps it in the dialog manager cache. On reopen, the same element is re-appended and connectedCallback() runs again, but _key, _error, and _secondsRemaining are not cleared first.
I added suggestions on where to clear them. There could be other/better places for it though.

if (this._interval) {
window.clearInterval(this._interval);
this._interval = undefined;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}
this._secondsRemaining = undefined;

ephemeralKey
).catch(() => {
// The key may already be expired or the router unreachable
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
});
});
this._key = undefined;

// Revoke the code so it cannot be used after the dialog is gone
if (this._key && this._secondsRemaining !== 0) {
this._revoke(this._key.ephemeral_key);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}
this._error = undefined;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate the current state of Thread credential sharing to deduct potential improvements

3 participants