Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

use lit update to recalculate values when data changes

Vincent56c170620908
diff --git a/ui/component/or-attribute-card/src/index.ts b/ui/component/or-attribute-card/src/index.ts
index 29f27212b..bac19254d 100644
--- a/ui/component/or-attribute-card/src/index.ts
+++ b/ui/component/or-attribute-card/src/index.ts
@@ -138,11 +138,21 @@ export class OrAttributeCard extends LitElement {
}
}
});
+
if (changedProperties.has("data")) {
this._chart.data.datasets![0].data = this.data;
this._chart.update();
}
+ if (changedProperties.has("mainValue") || changedProperties.has("mainValueLastPeriod")) {
+ if (this.mainValueLastPeriod && this.mainValue) {
+ this.delta = (this.mainValueLastPeriod! - this.mainValue!);
+ }
+ }
+ if (changedProperties.has("mainValue")) {
+ this.formattedMainValue = this.getFormattedValue(this.mainValue!);
+ }
+
}
protected render() {