Skip to content

Show pending channel migration status on Thread config page#51608

Open
raman325 wants to merge 6 commits intohome-assistant:devfrom
raman325:thread-pending-channel-migration
Open

Show pending channel migration status on Thread config page#51608
raman325 wants to merge 6 commits intohome-assistant:devfrom
raman325:thread-pending-channel-migration

Conversation

@raman325
Copy link
Copy Markdown
Contributor

@raman325 raman325 commented Apr 17, 2026

Proposed change

When a Thread channel change is initiated, the OTBR schedules a migration with a delay (default 5 minutes). Currently, once the user confirms the channel change, there is no visual indication that a migration is in progress. This PR adds a persistent alert banner inside the network card that shows:

  • The current and target channels with bold formatting and arrow separator
  • A live countdown using the existing hui-timestamp-display component with relative time formatting (auto-localized)
  • A cancel button to abort the pending migration

The implementation uses hui-timestamp-display for self-updating countdown rendering and a periodic server sync (every 30 seconds) to stay accurate and detect external cancellations. When the countdown reaches zero, a brief success message appears before the alert auto-clears.

Screenshots

image

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 development checklist
  • 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:

raman325 and others added 2 commits April 17, 2026 13:19
Add an alert banner inside the network card that displays when a Thread
channel change is in progress, with a live countdown timer and cancel
button. Uses hybrid approach: client-side countdown for responsiveness
with periodic server sync every 30s for accuracy.

Requires new backend WebSocket commands (otbr/get_pending_dataset and
otbr/delete_pending_dataset) to be implemented in home-assistant core.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Show current and target channels with bold formatting and arrow
separator. Add "migration in" prefix before the countdown timer.
Fix alert overlap with border router count by adding margin.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 feedback to the Thread integration config page so users can see (and cancel) an in-progress/pending OTBR channel migration, including a live countdown and periodic server re-sync to keep the timer accurate.

Changes:

  • Added new translation strings for pending channel change status, countdown formatting, cancel action, and completion message.
  • Implemented pending channel migration alert banner with client-side ticking + periodic refresh and a cancel action.
  • Added OTBR WebSocket helpers/types to fetch and delete the pending dataset.

Reviewed changes

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

File Description
src/translations/en.json Adds new UI strings for the pending channel migration alert and countdown formatting.
src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts Renders a pending migration banner, manages countdown/sync timers, and adds cancel handling for pending channel changes.
src/data/otbr.ts Adds OTBRPendingDataset plus WS helpers to get/delete pending datasets.

Comment thread src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts Outdated
Comment thread src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts Outdated
Comment thread src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts Outdated
Comment thread src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts Outdated
raman325 and others added 4 commits April 17, 2026 14:01
- Wrap countdown timer in aria-hidden span for screen reader compat
- Guard setTimeout callback with isConnected check
- Defer refresh to after tick loop to avoid multiple refreshes
- Clear pending state and timers when otbrInfo unavailable
- Use localized error title for cancel failure dialog
- Change "migration" to "cutover" in countdown text
- Fix prettier formatting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace custom tick-based countdown with hui-timestamp-display component
that manages its own per-second updates internally. Store end_time (Date)
instead of decrementing delay. Use setTimeout for completion detection
instead of per-second tick checking.

This removes ~60 lines of timer management code (countdown interval,
tick handler, timer update logic) in favor of the existing HA component.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove success state, completion migrations tracking, and sync interval.
The alert simply disappears when the timer expires and _refresh() is
called. Inline the completion scheduling into _refreshPendingDatasets.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@raman325
Copy link
Copy Markdown
Contributor Author

simplified the implementation:

  • use the built in time remaining component instead of building one
  • no temporary confirmation on the page
  • refresh happens on page render instead of on its own sync (the outcome is that if someone cancels elsewhere, you won't see the update until you refresh, but I think this is ok?)

screenshot updated

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.

3 participants