Update ZHA reconfigure device dialog to show accurate cluster configuration statuses (#19527)

This commit is contained in:
David F. Mulcahey 2024-01-31 03:50:55 -05:00 committed by GitHub
parent 374f5ee1be
commit 8acae63939
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 3 deletions

View File

@ -73,7 +73,7 @@ export interface ClusterAttributeData {
export interface AttributeConfigurationStatus {
id: number;
name: string;
success: boolean | undefined;
status: string;
min: number;
max: number;
change: number;

View File

@ -1,4 +1,5 @@
import "@material/mwc-button/mwc-button";
import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
import { mdiCheckCircle, mdiCloseCircle } from "@mdi/js";
import { UnsubscribeFunc } from "home-assistant-js-websocket";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
@ -56,6 +57,7 @@ class DialogZHAReconfigureDevice extends LitElement {
this._stages = undefined;
this._clusterConfigurationStatuses = undefined;
this._showDetails = false;
this._allSuccessful = true;
fireEvent(this, "dialog-closed", { dialog: this.localName });
}
@ -278,7 +280,7 @@ class DialogZHAReconfigureDevice extends LitElement {
(attribute) => html`
<span class="grid-item">
${attribute.name}:
${attribute.success
${attribute.status === "SUCCESS"
? html`
<span class="stage">
<ha-svg-icon
@ -289,6 +291,12 @@ class DialogZHAReconfigureDevice extends LitElement {
`
: html`
<span class="stage">
<simple-tooltip
animation-delay="0"
position="top"
>
${attribute.status}
</simple-tooltip>
<ha-svg-icon
.path=${mdiCloseCircle}
class="failed"
@ -361,7 +369,12 @@ class DialogZHAReconfigureDevice extends LitElement {
Object.keys(attributes).forEach((name) => {
const attribute = attributes[name];
clusterConfigurationStatus!.attributes.set(attribute.id, attribute);
this._allSuccessful = this._allSuccessful && attribute.success;
this._allSuccessful =
this._allSuccessful &&
!(
attribute.status in
["FAILURE", "UNSUPPORTED_ATTRIBUTE", "UNREPORTABLE_ATTRIBUTE"]
);
});
}
this.requestUpdate();