From f6087f3805d8846e021e217a50f1a5d0a0455cd6 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Tue, 15 Aug 2023 09:51:13 +0200 Subject: [PATCH] Adjust to otbr info including extended address (#17581) --- src/data/otbr.ts | 10 ++-------- .../integration-panels/thread/thread-config-panel.ts | 11 ++--------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/data/otbr.ts b/src/data/otbr.ts index 154d2863ff..604be8982a 100644 --- a/src/data/otbr.ts +++ b/src/data/otbr.ts @@ -1,9 +1,10 @@ import { HomeAssistant } from "../types"; export interface OTBRInfo { - url: string; active_dataset_tlvs: string; channel: number; + extended_address: string; + url: string; } export const getOTBRInfo = (hass: HomeAssistant): Promise => @@ -25,13 +26,6 @@ export const OTBRSetNetwork = ( dataset_id, }); -export const OTBRGetExtendedAddress = ( - hass: HomeAssistant -): Promise<{ extended_address: string }> => - hass.callWS({ - type: "otbr/get_extended_address", - }); - export const OTBRSetChannel = ( hass: HomeAssistant, channel: number 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 7aa43d3770..ef6ede8662 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 @@ -18,7 +18,6 @@ import { getConfigEntryDiagnosticsDownloadUrl } from "../../../../../data/diagno import { getOTBRInfo, OTBRCreateNetwork, - OTBRGetExtendedAddress, OTBRInfo, OTBRSetChannel, OTBRSetNetwork, @@ -63,7 +62,7 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) { @state() private _datasets: ThreadDataSet[] = []; - @state() private _otbrInfo?: OTBRInfo & { extended_address?: string }; + @state() private _otbrInfo?: OTBRInfo; protected render(): TemplateResult { const networks = this._groupRoutersByNetwork(this._routers, this._datasets); @@ -356,13 +355,7 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) { return; } try { - const _otbrAddress = OTBRGetExtendedAddress(this.hass); - const _otbrInfo = getOTBRInfo(this.hass); - const [otbrAddress, otbrInfo] = await Promise.all([ - _otbrAddress, - _otbrInfo, - ]); - this._otbrInfo = { ...otbrAddress, ...otbrInfo }; + this._otbrInfo = await getOTBRInfo(this.hass); } catch (err) { this._otbrInfo = undefined; }