mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 00:06:35 +00:00
Adjust to otbr info including extended address (#17581)
This commit is contained in:
parent
4979e89251
commit
f6087f3805
@ -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<OTBRInfo> =>
|
||||
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user