mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Handle breaking changes as result of zwave_js lib upgrade (#18009)
* Handle breaking changes as result of zwave_js lib upgrade * fix capitalization
This commit is contained in:
parent
30c6e4e35e
commit
5a5265723c
@ -192,7 +192,7 @@ export interface ZWaveJSController {
|
||||
supported_function_types: number[];
|
||||
suc_node_id: number;
|
||||
supports_timers: boolean;
|
||||
is_heal_network_active: boolean;
|
||||
is_rebuilding_routes: boolean;
|
||||
inclusion_state: InclusionState;
|
||||
nodes: ZWaveJSNodeStatus[];
|
||||
}
|
||||
@ -278,9 +278,9 @@ export interface ZWaveJSRefreshNodeStatusMessage {
|
||||
stage?: string;
|
||||
}
|
||||
|
||||
export interface ZWaveJSHealNetworkStatusMessage {
|
||||
export interface ZWaveJSRebuildRoutesStatusMessage {
|
||||
event: string;
|
||||
heal_node_status: { [key: number]: string };
|
||||
rebuild_routes_status: { [key: number]: string };
|
||||
}
|
||||
|
||||
export interface ZWaveJSControllerStatisticsUpdatedMessage {
|
||||
@ -651,12 +651,12 @@ export const reinterviewZwaveNode = (
|
||||
}
|
||||
);
|
||||
|
||||
export const healZwaveNode = (
|
||||
export const rebuildZwaveNodeRoutes = (
|
||||
hass: HomeAssistant,
|
||||
device_id: string
|
||||
): Promise<boolean> =>
|
||||
hass.callWS({
|
||||
type: "zwave_js/heal_node",
|
||||
type: "zwave_js/rebuild_node_routes",
|
||||
device_id,
|
||||
});
|
||||
|
||||
@ -673,33 +673,33 @@ export const removeFailedZwaveNode = (
|
||||
}
|
||||
);
|
||||
|
||||
export const healZwaveNetwork = (
|
||||
export const rebuildZwaveNetworkRoutes = (
|
||||
hass: HomeAssistant,
|
||||
entry_id: string
|
||||
): Promise<UnsubscribeFunc> =>
|
||||
hass.callWS({
|
||||
type: "zwave_js/begin_healing_network",
|
||||
type: "zwave_js/begin_rebuilding_routes",
|
||||
entry_id,
|
||||
});
|
||||
|
||||
export const stopHealZwaveNetwork = (
|
||||
export const stopRebuildingZwaveNetworkRoutes = (
|
||||
hass: HomeAssistant,
|
||||
entry_id: string
|
||||
): Promise<UnsubscribeFunc> =>
|
||||
hass.callWS({
|
||||
type: "zwave_js/stop_healing_network",
|
||||
type: "zwave_js/stop_rebuilding_routes",
|
||||
entry_id,
|
||||
});
|
||||
|
||||
export const subscribeHealZwaveNetworkProgress = (
|
||||
export const subscribeRebuildZwaveNetworkRoutesProgress = (
|
||||
hass: HomeAssistant,
|
||||
entry_id: string,
|
||||
callbackFunction: (message: ZWaveJSHealNetworkStatusMessage) => void
|
||||
callbackFunction: (message: ZWaveJSRebuildRoutesStatusMessage) => void
|
||||
): Promise<UnsubscribeFunc> =>
|
||||
hass.connection.subscribeMessage(
|
||||
(message: any) => callbackFunction(message),
|
||||
{
|
||||
type: "zwave_js/subscribe_heal_network_progress",
|
||||
type: "zwave_js/subscribe_rebuild_routes_progress",
|
||||
entry_id,
|
||||
}
|
||||
);
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
} from "../../../../../../data/zwave_js";
|
||||
import { showConfirmationDialog } from "../../../../../../dialogs/generic/show-dialog-box";
|
||||
import type { HomeAssistant } from "../../../../../../types";
|
||||
import { showZWaveJSHealNodeDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-heal-node";
|
||||
import { showZWaveJSRebuildNodeRoutesDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-rebuild-node-routes";
|
||||
import { showZWaveJSNodeStatisticsDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-node-statistics";
|
||||
import { showZWaveJSReinterviewNodeDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-reinterview-node";
|
||||
import { showZWaveJSRemoveFailedNodeDialog } from "../../../../integrations/integration-panels/zwave_js/show-dialog-zwave_js-remove-failed-node";
|
||||
@ -69,10 +69,12 @@ export const getZwaveDeviceActions = async (
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: hass.localize("ui.panel.config.zwave_js.device_info.heal_node"),
|
||||
label: hass.localize(
|
||||
"ui.panel.config.zwave_js.device_info.rebuild_routes"
|
||||
),
|
||||
icon: mdiHospitalBox,
|
||||
action: () =>
|
||||
showZWaveJSHealNodeDialog(el, {
|
||||
showZWaveJSRebuildNodeRoutesDialog(el, {
|
||||
device,
|
||||
}),
|
||||
},
|
||||
|
@ -8,18 +8,18 @@ import { fireEvent } from "../../../../../common/dom/fire_event";
|
||||
import { createCloseHeading } from "../../../../../components/ha-dialog";
|
||||
import {
|
||||
fetchZwaveNetworkStatus,
|
||||
healZwaveNetwork,
|
||||
stopHealZwaveNetwork,
|
||||
subscribeHealZwaveNetworkProgress,
|
||||
ZWaveJSHealNetworkStatusMessage,
|
||||
rebuildZwaveNetworkRoutes,
|
||||
stopRebuildingZwaveNetworkRoutes,
|
||||
subscribeRebuildZwaveNetworkRoutesProgress,
|
||||
ZWaveJSRebuildRoutesStatusMessage,
|
||||
ZWaveJSNetwork,
|
||||
} from "../../../../../data/zwave_js";
|
||||
import { haStyleDialog } from "../../../../../resources/styles";
|
||||
import { HomeAssistant } from "../../../../../types";
|
||||
import { ZWaveJSHealNetworkDialogParams } from "./show-dialog-zwave_js-heal-network";
|
||||
import { ZWaveJSRebuildNetworkRoutesDialogParams } from "./show-dialog-zwave_js-rebuild-network-routes";
|
||||
|
||||
@customElement("dialog-zwave_js-heal-network")
|
||||
class DialogZWaveJSHealNetwork extends LitElement {
|
||||
@customElement("dialog-zwave_js-rebuild-network-routes")
|
||||
class DialogZWaveJSRebuildNetworkRoutes extends LitElement {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
|
||||
@state() private entry_id?: string;
|
||||
@ -34,7 +34,7 @@ class DialogZWaveJSHealNetwork extends LitElement {
|
||||
|
||||
private _subscribed?: Promise<UnsubscribeFunc>;
|
||||
|
||||
public showDialog(params: ZWaveJSHealNetworkDialogParams): void {
|
||||
public showDialog(params: ZWaveJSRebuildNetworkRoutesDialogParams): void {
|
||||
this._progress_total = 0;
|
||||
this.entry_id = params.entry_id;
|
||||
this._fetchData();
|
||||
@ -61,7 +61,9 @@ class DialogZWaveJSHealNetwork extends LitElement {
|
||||
@closed=${this.closeDialog}
|
||||
.heading=${createCloseHeading(
|
||||
this.hass,
|
||||
this.hass.localize("ui.panel.config.zwave_js.heal_network.title")
|
||||
this.hass.localize(
|
||||
"ui.panel.config.zwave_js.rebuild_network_routes.title"
|
||||
)
|
||||
)}
|
||||
>
|
||||
${!this._status
|
||||
@ -74,7 +76,7 @@ class DialogZWaveJSHealNetwork extends LitElement {
|
||||
<div class="status">
|
||||
<p>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_network.introduction"
|
||||
"ui.panel.config.zwave_js.rebuild_network_routes.introduction"
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
@ -82,13 +84,16 @@ class DialogZWaveJSHealNetwork extends LitElement {
|
||||
<p>
|
||||
<em>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_network.traffic_warning"
|
||||
"ui.panel.config.zwave_js.rebuild_network_routes.traffic_warning"
|
||||
)}
|
||||
</em>
|
||||
</p>
|
||||
<mwc-button slot="primaryAction" @click=${this._startHeal}>
|
||||
<mwc-button
|
||||
slot="primaryAction"
|
||||
@click=${this._startRebuildingRoutes}
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_network.start_heal"
|
||||
"ui.panel.config.zwave_js.rebuild_network_routes.start_rebuilding_routes"
|
||||
)}
|
||||
</mwc-button>
|
||||
`
|
||||
@ -99,13 +104,13 @@ class DialogZWaveJSHealNetwork extends LitElement {
|
||||
<p>
|
||||
<b>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_network.in_progress"
|
||||
"ui.panel.config.zwave_js.rebuild_network_routes.in_progress"
|
||||
)}
|
||||
</b>
|
||||
</p>
|
||||
<p>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_network.run_in_background"
|
||||
"ui.panel.config.zwave_js.rebuild_network_routes.run_in_background"
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
@ -114,9 +119,12 @@ class DialogZWaveJSHealNetwork extends LitElement {
|
||||
<mwc-linear-progress indeterminate> </mwc-linear-progress>
|
||||
`
|
||||
: ""}
|
||||
<mwc-button slot="secondaryAction" @click=${this._stopHeal}>
|
||||
<mwc-button
|
||||
slot="secondaryAction"
|
||||
@click=${this._stopRebuildingRoutes}
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_network.stop_heal"
|
||||
"ui.panel.config.zwave_js.rebuild_network_routes.stop_rebuilding_routes"
|
||||
)}
|
||||
</mwc-button>
|
||||
<mwc-button slot="primaryAction" @click=${this.closeDialog}>
|
||||
@ -134,7 +142,7 @@ class DialogZWaveJSHealNetwork extends LitElement {
|
||||
<div class="status">
|
||||
<p>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_network.healing_failed"
|
||||
"ui.panel.config.zwave_js.rebuild_network_routes.rebuilding_routes_failed"
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
@ -154,7 +162,7 @@ class DialogZWaveJSHealNetwork extends LitElement {
|
||||
<div class="status">
|
||||
<p>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_network.healing_complete"
|
||||
"ui.panel.config.zwave_js.rebuild_network_routes.rebuilding_routes_complete"
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
@ -174,7 +182,7 @@ class DialogZWaveJSHealNetwork extends LitElement {
|
||||
<div class="status">
|
||||
<p>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_network.healing_cancelled"
|
||||
"ui.panel.config.zwave_js.rebuild_network_routes.rebuilding_routes_cancelled"
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
@ -205,9 +213,9 @@ class DialogZWaveJSHealNetwork extends LitElement {
|
||||
const network: ZWaveJSNetwork = await fetchZwaveNetworkStatus(this.hass!, {
|
||||
entry_id: this.entry_id!,
|
||||
});
|
||||
if (network.controller.is_heal_network_active) {
|
||||
if (network.controller.is_rebuilding_routes) {
|
||||
this._status = "started";
|
||||
this._subscribed = subscribeHealZwaveNetworkProgress(
|
||||
this._subscribed = subscribeRebuildZwaveNetworkRoutesProgress(
|
||||
this.hass,
|
||||
this.entry_id!,
|
||||
this._handleMessage.bind(this)
|
||||
@ -215,33 +223,33 @@ class DialogZWaveJSHealNetwork extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
private _startHeal(): void {
|
||||
private _startRebuildingRoutes(): void {
|
||||
if (!this.hass) {
|
||||
return;
|
||||
}
|
||||
healZwaveNetwork(this.hass, this.entry_id!);
|
||||
rebuildZwaveNetworkRoutes(this.hass, this.entry_id!);
|
||||
this._status = "started";
|
||||
this._subscribed = subscribeHealZwaveNetworkProgress(
|
||||
this._subscribed = subscribeRebuildZwaveNetworkRoutesProgress(
|
||||
this.hass,
|
||||
this.entry_id!,
|
||||
this._handleMessage.bind(this)
|
||||
);
|
||||
}
|
||||
|
||||
private _stopHeal(): void {
|
||||
private _stopRebuildingRoutes(): void {
|
||||
if (!this.hass) {
|
||||
return;
|
||||
}
|
||||
stopHealZwaveNetwork(this.hass, this.entry_id!);
|
||||
stopRebuildingZwaveNetworkRoutes(this.hass, this.entry_id!);
|
||||
this._unsubscribe();
|
||||
this._status = "cancelled";
|
||||
}
|
||||
|
||||
private _handleMessage(message: ZWaveJSHealNetworkStatusMessage): void {
|
||||
if (message.event === "heal network progress") {
|
||||
private _handleMessage(message: ZWaveJSRebuildRoutesStatusMessage): void {
|
||||
if (message.event === "rebuild routes progress") {
|
||||
let finished = 0;
|
||||
let in_progress = 0;
|
||||
for (const status of Object.values(message.heal_node_status)) {
|
||||
for (const status of Object.values(message.rebuild_routes_status)) {
|
||||
if (status === "pending") {
|
||||
in_progress++;
|
||||
}
|
||||
@ -249,11 +257,11 @@ class DialogZWaveJSHealNetwork extends LitElement {
|
||||
finished++;
|
||||
}
|
||||
}
|
||||
this._progress_total = Object.keys(message.heal_node_status).length;
|
||||
this._progress_total = Object.keys(message.rebuild_routes_status).length;
|
||||
this._progress_finished = finished / this._progress_total;
|
||||
this._progress_in_progress = in_progress / this._progress_total;
|
||||
}
|
||||
if (message.event === "heal network done") {
|
||||
if (message.event === "rebuild routes done") {
|
||||
this._unsubscribe();
|
||||
this._status = "finished";
|
||||
}
|
||||
@ -306,6 +314,6 @@ class DialogZWaveJSHealNetwork extends LitElement {
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"dialog-zwave_js-heal-network": DialogZWaveJSHealNetwork;
|
||||
"dialog-zwave_js-rebuild-network-routes": DialogZWaveJSRebuildNetworkRoutes;
|
||||
}
|
||||
}
|
@ -11,15 +11,15 @@ import {
|
||||
} from "../../../../../data/device_registry";
|
||||
import {
|
||||
fetchZwaveNetworkStatus,
|
||||
healZwaveNode,
|
||||
rebuildZwaveNodeRoutes,
|
||||
ZWaveJSNetwork,
|
||||
} from "../../../../../data/zwave_js";
|
||||
import { haStyleDialog } from "../../../../../resources/styles";
|
||||
import { HomeAssistant } from "../../../../../types";
|
||||
import { ZWaveJSHealNodeDialogParams } from "./show-dialog-zwave_js-heal-node";
|
||||
import { ZWaveJSRebuildNodeRoutesDialogParams } from "./show-dialog-zwave_js-rebuild-node-routes";
|
||||
|
||||
@customElement("dialog-zwave_js-heal-node")
|
||||
class DialogZWaveJSHealNode extends LitElement {
|
||||
@customElement("dialog-zwave_js-rebuild-node-routes")
|
||||
class DialogZWaveJSRebuildNodeRoutes extends LitElement {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
|
||||
@state() private device?: DeviceRegistryEntry;
|
||||
@ -28,7 +28,7 @@ class DialogZWaveJSHealNode extends LitElement {
|
||||
|
||||
@state() private _error?: string;
|
||||
|
||||
public showDialog(params: ZWaveJSHealNodeDialogParams): void {
|
||||
public showDialog(params: ZWaveJSRebuildNodeRoutesDialogParams): void {
|
||||
this.device = params.device;
|
||||
this._fetchData();
|
||||
}
|
||||
@ -52,7 +52,9 @@ class DialogZWaveJSHealNode extends LitElement {
|
||||
@closed=${this.closeDialog}
|
||||
.heading=${createCloseHeading(
|
||||
this.hass,
|
||||
this.hass.localize("ui.panel.config.zwave_js.heal_node.title")
|
||||
this.hass.localize(
|
||||
"ui.panel.config.zwave_js.rebuild_node_routes.title"
|
||||
)
|
||||
)}
|
||||
>
|
||||
${!this._status
|
||||
@ -65,7 +67,7 @@ class DialogZWaveJSHealNode extends LitElement {
|
||||
<div class="status">
|
||||
<p>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_node.introduction",
|
||||
"ui.panel.config.zwave_js.rebuild_node_routes.introduction",
|
||||
{
|
||||
device: html`<em
|
||||
>${computeDeviceName(this.device, this.hass!)}</em
|
||||
@ -78,13 +80,16 @@ class DialogZWaveJSHealNode extends LitElement {
|
||||
<p>
|
||||
<em>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_node.traffic_warning"
|
||||
"ui.panel.config.zwave_js.rebuild_node_routes.traffic_warning"
|
||||
)}
|
||||
</em>
|
||||
</p>
|
||||
<mwc-button slot="primaryAction" @click=${this._startHeal}>
|
||||
<mwc-button
|
||||
slot="primaryAction"
|
||||
@click=${this._startRebuildingRoutes}
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_node.start_heal"
|
||||
"ui.panel.config.zwave_js.rebuild_node_routes.start_rebuilding_routes"
|
||||
)}
|
||||
</mwc-button>
|
||||
`
|
||||
@ -96,7 +101,7 @@ class DialogZWaveJSHealNode extends LitElement {
|
||||
<div class="status">
|
||||
<p>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_node.in_progress",
|
||||
"ui.panel.config.zwave_js.rebuild_node_routes.in_progress",
|
||||
{
|
||||
device: html`<em
|
||||
>${computeDeviceName(this.device, this.hass!)}</em
|
||||
@ -121,7 +126,7 @@ class DialogZWaveJSHealNode extends LitElement {
|
||||
<div class="status">
|
||||
<p>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_node.healing_failed",
|
||||
"ui.panel.config.zwave_js.rebuild_node_routes.rebuilding_routes_failed",
|
||||
{
|
||||
device: html`<em
|
||||
>${computeDeviceName(this.device, this.hass!)}</em
|
||||
@ -134,7 +139,7 @@ class DialogZWaveJSHealNode extends LitElement {
|
||||
? html` <em>${this._error}</em> `
|
||||
: `
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_node.healing_failed_check_logs"
|
||||
"ui.panel.config.zwave_js.rebuild_node_routes.rebuilding_routes_failed_check_logs"
|
||||
)}
|
||||
`}
|
||||
</p>
|
||||
@ -155,7 +160,7 @@ class DialogZWaveJSHealNode extends LitElement {
|
||||
<div class="status">
|
||||
<p>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_node.healing_complete",
|
||||
"ui.panel.config.zwave_js.rebuild_node_routes.rebuilding_routes_complete",
|
||||
{
|
||||
device: html`<em
|
||||
>${computeDeviceName(this.device, this.hass!)}</em
|
||||
@ -170,7 +175,7 @@ class DialogZWaveJSHealNode extends LitElement {
|
||||
</mwc-button>
|
||||
`
|
||||
: ``}
|
||||
${this._status === "network-healing"
|
||||
${this._status === "rebuilding-routes"
|
||||
? html`
|
||||
<div class="flex-container">
|
||||
<ha-svg-icon
|
||||
@ -180,7 +185,7 @@ class DialogZWaveJSHealNode extends LitElement {
|
||||
<div class="status">
|
||||
<p>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.heal_node.network_heal_in_progress"
|
||||
"ui.panel.config.zwave_js.rebuild_node_routes.routes_rebuild_in_progress"
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
@ -201,18 +206,18 @@ class DialogZWaveJSHealNode extends LitElement {
|
||||
const network: ZWaveJSNetwork = await fetchZwaveNetworkStatus(this.hass!, {
|
||||
device_id: this.device!.id,
|
||||
});
|
||||
if (network.controller.is_heal_network_active) {
|
||||
this._status = "network-healing";
|
||||
if (network.controller.is_rebuilding_routes) {
|
||||
this._status = "rebuilding-routes";
|
||||
}
|
||||
}
|
||||
|
||||
private async _startHeal(): Promise<void> {
|
||||
private async _startRebuildingRoutes(): Promise<void> {
|
||||
if (!this.hass) {
|
||||
return;
|
||||
}
|
||||
this._status = "started";
|
||||
try {
|
||||
this._status = (await healZwaveNode(this.hass, this.device!.id))
|
||||
this._status = (await rebuildZwaveNodeRoutes(this.hass, this.device!.id))
|
||||
? "finished"
|
||||
: "failed";
|
||||
} catch (err: any) {
|
||||
@ -258,6 +263,6 @@ class DialogZWaveJSHealNode extends LitElement {
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"dialog-zwave_js-heal-node": DialogZWaveJSHealNode;
|
||||
"dialog-zwave_js-rebuild-node-routes": DialogZWaveJSRebuildNodeRoutes;
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
import { fireEvent } from "../../../../../common/dom/fire_event";
|
||||
|
||||
export interface ZWaveJSHealNetworkDialogParams {
|
||||
entry_id: string;
|
||||
}
|
||||
|
||||
export const loadHealNetworkDialog = () =>
|
||||
import("./dialog-zwave_js-heal-network");
|
||||
|
||||
export const showZWaveJSHealNetworkDialog = (
|
||||
element: HTMLElement,
|
||||
healNetworkDialogParams: ZWaveJSHealNetworkDialogParams
|
||||
): void => {
|
||||
fireEvent(element, "show-dialog", {
|
||||
dialogTag: "dialog-zwave_js-heal-network",
|
||||
dialogImport: loadHealNetworkDialog,
|
||||
dialogParams: healNetworkDialogParams,
|
||||
});
|
||||
};
|
@ -1,19 +0,0 @@
|
||||
import { fireEvent } from "../../../../../common/dom/fire_event";
|
||||
import { DeviceRegistryEntry } from "../../../../../data/device_registry";
|
||||
|
||||
export interface ZWaveJSHealNodeDialogParams {
|
||||
device: DeviceRegistryEntry;
|
||||
}
|
||||
|
||||
export const loadHealNodeDialog = () => import("./dialog-zwave_js-heal-node");
|
||||
|
||||
export const showZWaveJSHealNodeDialog = (
|
||||
element: HTMLElement,
|
||||
healNodeDialogParams: ZWaveJSHealNodeDialogParams
|
||||
): void => {
|
||||
fireEvent(element, "show-dialog", {
|
||||
dialogTag: "dialog-zwave_js-heal-node",
|
||||
dialogImport: loadHealNodeDialog,
|
||||
dialogParams: healNodeDialogParams,
|
||||
});
|
||||
};
|
@ -0,0 +1,19 @@
|
||||
import { fireEvent } from "../../../../../common/dom/fire_event";
|
||||
|
||||
export interface ZWaveJSRebuildNetworkRoutesDialogParams {
|
||||
entry_id: string;
|
||||
}
|
||||
|
||||
export const loadRebuildNetworkRoutesDialog = () =>
|
||||
import("./dialog-zwave_js-rebuild-network-routes");
|
||||
|
||||
export const showZWaveJSRebuildNetworkRoutesDialog = (
|
||||
element: HTMLElement,
|
||||
rebuildNetworkRoutesDialogParams: ZWaveJSRebuildNetworkRoutesDialogParams
|
||||
): void => {
|
||||
fireEvent(element, "show-dialog", {
|
||||
dialogTag: "dialog-zwave_js-rebuild-network-routes",
|
||||
dialogImport: loadRebuildNetworkRoutesDialog,
|
||||
dialogParams: rebuildNetworkRoutesDialogParams,
|
||||
});
|
||||
};
|
@ -0,0 +1,20 @@
|
||||
import { fireEvent } from "../../../../../common/dom/fire_event";
|
||||
import { DeviceRegistryEntry } from "../../../../../data/device_registry";
|
||||
|
||||
export interface ZWaveJSRebuildNodeRoutesDialogParams {
|
||||
device: DeviceRegistryEntry;
|
||||
}
|
||||
|
||||
export const loadRebuildNodeRoutesDialog = () =>
|
||||
import("./dialog-zwave_js-rebuild-node-routes");
|
||||
|
||||
export const showZWaveJSRebuildNodeRoutesDialog = (
|
||||
element: HTMLElement,
|
||||
rebuildNodeRoutesDialogParams: ZWaveJSRebuildNodeRoutesDialogParams
|
||||
): void => {
|
||||
fireEvent(element, "show-dialog", {
|
||||
dialogTag: "dialog-zwave_js-rebuild-node-routes",
|
||||
dialogImport: loadRebuildNodeRoutesDialog,
|
||||
dialogParams: rebuildNodeRoutesDialogParams,
|
||||
});
|
||||
};
|
@ -52,7 +52,7 @@ import { haStyle } from "../../../../../resources/styles";
|
||||
import type { HomeAssistant, Route } from "../../../../../types";
|
||||
import "../../../ha-config-section";
|
||||
import { showZWaveJSAddNodeDialog } from "./show-dialog-zwave_js-add-node";
|
||||
import { showZWaveJSHealNetworkDialog } from "./show-dialog-zwave_js-heal-network";
|
||||
import { showZWaveJSRebuildNetworkRoutesDialog } from "./show-dialog-zwave_js-rebuild-network-routes";
|
||||
import { showZWaveJSRemoveNodeDialog } from "./show-dialog-zwave_js-remove-node";
|
||||
import { configTabs } from "./zwave_js-config-router";
|
||||
|
||||
@ -430,11 +430,11 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) {
|
||||
)}
|
||||
</mwc-button>
|
||||
<mwc-button
|
||||
@click=${this._healNetworkClicked}
|
||||
@click=${this._rebuildNetworkRoutesClicked}
|
||||
.disabled=${this._status === "disconnected"}
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.common.heal_network"
|
||||
"ui.panel.config.zwave_js.common.rebuild_network_routes"
|
||||
)}
|
||||
</mwc-button>
|
||||
<mwc-button @click=${this._openOptionFlow}>
|
||||
@ -612,8 +612,8 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) {
|
||||
});
|
||||
}
|
||||
|
||||
private async _healNetworkClicked() {
|
||||
showZWaveJSHealNetworkDialog(this, {
|
||||
private async _rebuildNetworkRoutesClicked() {
|
||||
showZWaveJSRebuildNetworkRoutesDialog(this, {
|
||||
entry_id: this.configEntryId!,
|
||||
});
|
||||
}
|
||||
|
@ -3934,7 +3934,7 @@
|
||||
"add_node": "Add device",
|
||||
"remove_node": "Remove device",
|
||||
"reconfigure_server": "Re-configure server",
|
||||
"heal_network": "Heal Network",
|
||||
"rebuild_network_routes": "Rebuild network routes",
|
||||
"in_progress_inclusion_exclusion": "Z-Wave JS is searching for devices",
|
||||
"cancel_inclusion_exclusion": "Stop searching"
|
||||
},
|
||||
@ -3994,7 +3994,7 @@
|
||||
"node_ready": "Ready",
|
||||
"device_config": "Configure",
|
||||
"reinterview_device": "Re-interview",
|
||||
"heal_node": "Heal",
|
||||
"rebuild_routes": "Rebuild routes",
|
||||
"remove_failed": "Remove failed",
|
||||
"update_firmware": "Update",
|
||||
"highest_security": "Highest security",
|
||||
@ -4176,28 +4176,28 @@
|
||||
"interview_failed": "The device interview failed. Additional information may be available in the logs.",
|
||||
"interview_complete": "Device interview complete."
|
||||
},
|
||||
"heal_network": {
|
||||
"title": "Heal your Z-Wave network",
|
||||
"introduction": "Start a network heal on your Z-Wave network. A network heal will cause all devices to re-calculate their routes back to the controller and is recommended if you have recently moved devices or your controller.",
|
||||
"traffic_warning": "The healing process generates a large amount of traffic on the Z-Wave network. This may cause devices to respond slowly (or not at all) while the heal is in progress.",
|
||||
"start_heal": "Start healing",
|
||||
"in_progress": "Network healing is in progress. This will take some time.",
|
||||
"run_in_background": "You can close this dialog and the network healing will continue in the background.",
|
||||
"stop_heal": "Stop Healing",
|
||||
"healing_complete": "Network healing is complete.",
|
||||
"healing_failed": "Healing failed. Additional information may be available in the logs.",
|
||||
"healing_cancelled": "Network healing has been cancelled."
|
||||
"rebuild_network_routes": {
|
||||
"title": "Rebuild routes for your Z-Wave network",
|
||||
"introduction": "Start rebuilding routes on your Z-Wave network. Rebuilding routes will cause all devices to re-calculate their routes back to the controller and is recommended if you have recently moved devices or your controller.",
|
||||
"traffic_warning": "The rebuilding process generates a large amount of traffic on the Z-Wave network. This may cause devices to respond slowly (or not at all) while the rebuild is in progress.",
|
||||
"start_rebuilding_routes": "Start rebuilding routes",
|
||||
"in_progress": "Rebuild of network routes is in progress. This will take some time.",
|
||||
"run_in_background": "You can close this dialog and the rebuild of network routes will continue in the background.",
|
||||
"stop_rebuilding_routes": "Stop rebuilding routes",
|
||||
"rebuilding_routes_complete": "Routes have been rebuilt.",
|
||||
"rebuilding_routes_failed": "Route rebuilding failed. Additional information may be available in the logs.",
|
||||
"rebuilding_routes_cancelled": "Rebuilding network routes has been cancelled."
|
||||
},
|
||||
"heal_node": {
|
||||
"title": "Heal a Z-Wave device",
|
||||
"rebuild_node_routes": {
|
||||
"title": "Rebuild routes for a Z-Wave device",
|
||||
"introduction": "Tell {device} to update its routes back to the controller. This can help with communication issues if you have recently moved the device or your controller.",
|
||||
"traffic_warning": "The healing process generates a large amount of traffic on the Z-Wave network. This may cause devices to respond slowly (or not at all) while the heal is in progress.",
|
||||
"start_heal": "Heal Device",
|
||||
"healing_failed": "{device} could not be healed.",
|
||||
"healing_failed_check_logs": "Additional information may be available in the logs.",
|
||||
"healing_complete": "{device} has been healed.",
|
||||
"in_progress": "{device} healing is in progress.",
|
||||
"network_heal_in_progress": "A Z-Wave network heal is already in progress. Please wait for it to finish before healing an individual device."
|
||||
"traffic_warning": "The route rebuilding process generates a large amount of traffic on the Z-Wave network. This may cause devices to respond slowly (or not at all) while the rebuilding is in progress.",
|
||||
"start_rebuilding_routes": "Rebuild Routes for Device",
|
||||
"rebuilding_routes_failed": "{device} routes could not be rebuild.",
|
||||
"rebuilding_routes_failed_check_logs": "Additional information may be available in the logs.",
|
||||
"rebuilding_routes_complete": "{device} routes have been rebuilt.",
|
||||
"in_progress": "{device} routes rebuild is in progress.",
|
||||
"routes_rebuild_in_progress": "A Z-Wave routes rebuild is already in progress. Please wait for it to finish before rebuilding routes for an individual device."
|
||||
},
|
||||
"update_firmware": {
|
||||
"title": "Update device firmware",
|
||||
|
Loading…
x
Reference in New Issue
Block a user