Add Thread credential sharing to the Thread panel - #53330
Conversation
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.
There was a problem hiding this comment.
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.
| title: this.hass.localize( | ||
| "ui.panel.config.thread.share_credentials_failed" | ||
| ), | ||
| text: err.message, | ||
| }); |
This comment has been minimized.
This comment has been minimized.
MindFreeze
left a comment
There was a problem hiding this comment.
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; | ||
| } |
There was a problem hiding this comment.
| } | |
| } | |
| this._secondsRemaining = undefined; |
| ephemeralKey | ||
| ).catch(() => { | ||
| // The key may already be expired or the router unreachable | ||
| }); |
There was a problem hiding this comment.
| }); | |
| }); | |
| 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); | ||
| } |
There was a problem hiding this comment.
| } | |
| } | |
| this._error = undefined; |


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
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed:
To help with the load of incoming pull requests: