100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
round to 1 decimal by default
Vincent83e6370d7206
diff --git a/ui/component/or-attribute-card/src/index.ts b/ui/component/or-attribute-card/src/index.tsindex c746c1217..2597ca5a5 100644--- a/ui/component/or-attribute-card/src/index.ts+++ b/ui/component/or-attribute-card/src/index.ts@@ -647,16 +647,17 @@ export class OrAttributeCard extends LitElement {protected getFormattedValue(value: number): {value: number, unit: string, formattedValue: string} {const format = getMetaValue(MetaItemType.FORMAT, this.asset.attributes![this.attributeName!], undefined);+ const roundedVal = +value.toFixed(1); // + operator prevents str returnif (!format) {- return {value: value, unit: "", formattedValue: value.toString()};+ return {value: roundedVal, unit: "", formattedValue: value.toString()};}const unit = format.split(" ").pop();return {- value: value,+ value: roundedVal,unit: unit,- formattedValue: i18next.t(format, { postProcess: "sprintf", sprintf: [value] }).trim()+ formattedValue: i18next.t(format, { postProcess: "sprintf", sprintf: [roundedVal] }).trim()};}