mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +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";
|
import { HomeAssistant } from "../types";
|
||||||
|
|
||||||
export interface OTBRInfo {
|
export interface OTBRInfo {
|
||||||
url: string;
|
|
||||||
active_dataset_tlvs: string;
|
active_dataset_tlvs: string;
|
||||||
channel: number;
|
channel: number;
|
||||||
|
extended_address: string;
|
||||||
|
url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getOTBRInfo = (hass: HomeAssistant): Promise<OTBRInfo> =>
|
export const getOTBRInfo = (hass: HomeAssistant): Promise<OTBRInfo> =>
|
||||||
@ -25,13 +26,6 @@ export const OTBRSetNetwork = (
|
|||||||
dataset_id,
|
dataset_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const OTBRGetExtendedAddress = (
|
|
||||||
hass: HomeAssistant
|
|
||||||
): Promise<{ extended_address: string }> =>
|
|
||||||
hass.callWS({
|
|
||||||
type: "otbr/get_extended_address",
|
|
||||||
});
|
|
||||||
|
|
||||||
export const OTBRSetChannel = (
|
export const OTBRSetChannel = (
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
channel: number
|
channel: number
|
||||||
|
@ -18,7 +18,6 @@ import { getConfigEntryDiagnosticsDownloadUrl } from "../../../../../data/diagno
|
|||||||
import {
|
import {
|
||||||
getOTBRInfo,
|
getOTBRInfo,
|
||||||
OTBRCreateNetwork,
|
OTBRCreateNetwork,
|
||||||
OTBRGetExtendedAddress,
|
|
||||||
OTBRInfo,
|
OTBRInfo,
|
||||||
OTBRSetChannel,
|
OTBRSetChannel,
|
||||||
OTBRSetNetwork,
|
OTBRSetNetwork,
|
||||||
@ -63,7 +62,7 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) {
|
|||||||
|
|
||||||
@state() private _datasets: ThreadDataSet[] = [];
|
@state() private _datasets: ThreadDataSet[] = [];
|
||||||
|
|
||||||
@state() private _otbrInfo?: OTBRInfo & { extended_address?: string };
|
@state() private _otbrInfo?: OTBRInfo;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
const networks = this._groupRoutersByNetwork(this._routers, this._datasets);
|
const networks = this._groupRoutersByNetwork(this._routers, this._datasets);
|
||||||
@ -356,13 +355,7 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const _otbrAddress = OTBRGetExtendedAddress(this.hass);
|
this._otbrInfo = await getOTBRInfo(this.hass);
|
||||||
const _otbrInfo = getOTBRInfo(this.hass);
|
|
||||||
const [otbrAddress, otbrInfo] = await Promise.all([
|
|
||||||
_otbrAddress,
|
|
||||||
_otbrInfo,
|
|
||||||
]);
|
|
||||||
this._otbrInfo = { ...otbrAddress, ...otbrInfo };
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this._otbrInfo = undefined;
|
this._otbrInfo = undefined;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user