From 92165d776a33aa4b0c79837508cd87f17aeb00c5 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 10 Oct 2024 16:50:44 +0200 Subject: [PATCH] Fix command selection for OTBRs without dataset (#22318) Typically, the Home Assistant OTBR integration makes sure that we either setup or read the current dataset. However, in some cases, e.g. when reinstalling the add-on, deleting the dataset, and starting the add-on while keeping the OTBR config entry, the dataset is not available and a new one is not being created (since the config entry is not recreated). Just support this particular case as well. Fixes: #22306 --- .../integration-panels/thread/thread-config-panel.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts b/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts index 206ab96194..e0da88509d 100644 --- a/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts +++ b/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts @@ -482,7 +482,9 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) { const network = (ev.currentTarget as any).network as ThreadNetwork; const router = (ev.currentTarget as any).router as ThreadRouter; const otbr = (ev.currentTarget as any).otbr as OTBRInfo; - const index = Number(ev.detail.index); + const index = network.dataset + ? Number(ev.detail.index) + : Number(ev.detail.index) + 1; switch (index) { case 0: this._setPreferredBorderAgent(network.dataset!, router);