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 { export interface AttributeConfigurationStatus {
id: number; id: number;
name: string; name: string;
success: boolean | undefined; status: string;
min: number; min: number;
max: number; max: number;
change: number; change: number;

View File

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