From 885a63d3f6fb2ae027efa95ce8f9a0df55c406b0 Mon Sep 17 00:00:00 2001
From: Petar Petrov
Date: Mon, 21 Oct 2024 17:05:44 +0300
Subject: [PATCH] Improve warnings for insecure zwavejs inclusion (#22456)
* Improve warnings for insecure zwavejs inclusion
* is isNaN
Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>
* use `nothing`
Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>
---------
Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>
---
.../zwave_js/dialog-zwave_js-add-node.ts | 47 +++++++++++++++++--
src/translations/en.json | 16 ++++++-
2 files changed, 57 insertions(+), 6 deletions(-)
diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts
index b5936e640bcc..8955ff5c162c 100644
--- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts
+++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts
@@ -80,6 +80,8 @@ class DialogZWaveJSAddNode extends LitElement {
@state() private _lowSecurity = false;
+ @state() private _lowSecurityReason?: number;
+
@state() private _supportsSmartStart?: boolean;
private _addNodeTimeoutHandle?: number;
@@ -406,6 +408,26 @@ class DialogZWaveJSAddNode extends LitElement {
)}
+ ${this._lowSecurity
+ ? html`
+ ${this.hass.localize(
+ "ui.panel.config.zwave_js.add_node.added_insecurely_text"
+ )}
+ ${typeof this._lowSecurityReason !==
+ "undefined"
+ ? html`
+ ${this.hass.localize(
+ `ui.panel.config.zwave_js.add_node.low_security_reason.${this._lowSecurityReason}`
+ )}
+
`
+ : ""}
+ `
+ : ""}
${this._stages
? html`
${this._stages.map(
@@ -489,12 +511,22 @@ class DialogZWaveJSAddNode extends LitElement {
${this._lowSecurity
? html`
- There was an error during secure
- inclusion. You can try again by
- excluding the device and adding it
- again.
+ ${this.hass.localize(
+ "ui.panel.config.zwave_js.add_node.added_insecurely_text"
+ )}
+ ${typeof this
+ ._lowSecurityReason !==
+ "undefined"
+ ? html`
+ ${this.hass.localize(
+ `ui.panel.config.zwave_js.add_node.low_security_reason.${this._lowSecurityReason}`
+ )}
+
`
+ : nothing}
`
: ""}