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>
This commit is contained in:
Petar Petrov 2024-10-21 17:05:44 +03:00 committed by GitHub
parent 206fbac618
commit 885a63d3f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 57 additions and 6 deletions

View File

@ -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 {
)}</b
>
</p>
${this._lowSecurity
? html`<ha-alert
alert-type="warning"
title=${this.hass.localize(
"ui.panel.config.zwave_js.add_node.adding_insecurely"
)}
>
${this.hass.localize(
"ui.panel.config.zwave_js.add_node.added_insecurely_text"
)}
${typeof this._lowSecurityReason !==
"undefined"
? html`<p>
${this.hass.localize(
`ui.panel.config.zwave_js.add_node.low_security_reason.${this._lowSecurityReason}`
)}
</p>`
: ""}
</ha-alert>`
: ""}
${this._stages
? html` <div class="stages">
${this._stages.map(
@ -489,12 +511,22 @@ class DialogZWaveJSAddNode extends LitElement {
${this._lowSecurity
? html`<ha-alert
alert-type="warning"
title="The device was added insecurely"
title=${this.hass.localize(
"ui.panel.config.zwave_js.add_node.added_insecurely"
)}
>
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`<p>
${this.hass.localize(
`ui.panel.config.zwave_js.add_node.low_security_reason.${this._lowSecurityReason}`
)}
</p>`
: nothing}
</ha-alert>`
: ""}
<a
@ -790,6 +822,7 @@ class DialogZWaveJSAddNode extends LitElement {
if (message.event === "node added") {
this._status = "interviewing";
this._lowSecurity = message.node.low_security;
this._lowSecurityReason = message.node.low_security_reason;
}
if (message.event === "interview completed") {
@ -954,6 +987,10 @@ class DialogZWaveJSAddNode extends LitElement {
margin-inline-end: 20px;
margin-inline-start: initial;
}
.status {
flex: 1;
}
`,
];
}

View File

@ -4966,7 +4966,21 @@
"view_device": "View Device",
"interview_started": "The device is being interviewed. This may take some time.",
"interview_failed": "The device interview failed. Additional information may be available in the logs.",
"waiting_for_device": "Communicating with the device. Please wait."
"waiting_for_device": "Communicating with the device. Please wait.",
"adding_insecurely": "The device is being added insecurely",
"added_insecurely": "The device was added insecurely",
"added_insecurely_text": "There was an error during secure inclusion. You can try again by excluding the device and adding it again.",
"low_security_reason": {
"0": "Security bootstrapping was canceled by the user.",
"1": "The required security keys were not configured in the driver.",
"2": "No Security S2 user callbacks (or provisioning info) were provided to grant security classes and/or validate the DSK.",
"3": "An expected message was not received within the corresponding timeout.",
"4": "There was no possible match in encryption parameters between the controller and the node.",
"5": "Security bootstrapping was canceled by the included node.",
"6": "The PIN was incorrect, so the included node could not decode the key exchange commands.",
"7": "There was a mismatch in security keys between the controller and the node.",
"8": "Unknown error occurred."
}
},
"provisioned": {
"dsk": "DSK",