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
Added UNIT_TYPE constants
Rich Turnera1cc0c261aa5
diff --git a/model/src/main/java/org/openremote/model/Constants.java b/model/src/main/java/org/openremote/model/Constants.javaindex 1a399832c..e1617b12b 100644--- a/model/src/main/java/org/openremote/model/Constants.java+++ b/model/src/main/java/org/openremote/model/Constants.java@@ -66,4 +66,11 @@ public interface Constants {String UNITS_TEMPERATURE_CELCIUS = "CELCIUS";String UNITS_TIME_MINUTES = "MINUTES";+ String UNITS_SPEED_KNOTS = "KNOTS";+ String UNITS_SPEED_KPH = "SPEED_KPH";+ String UNITS_SPEED_MPS = "SPEED_MPS";+ String UNITS_SOUND_DECIBELS = "DECIBELS";+ String UNITS_DISTANCE_METRES = "METRES";+ String UNITS_DIRECTION_DEGREES = "DEGREES";+ String UNITS_FLOW_LPM = "FLOW_LPM";}diff --git a/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java b/model/src/main/java/org/openremote/model/attribute/AttributeValueType.javaindex e39a7c458..3a4cce657 100644--- a/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java+++ b/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java@@ -20,6 +20,7 @@package org.openremote.model.attribute;import com.fasterxml.jackson.annotation.JsonIgnore;+import org.openremote.model.Constants;import org.openremote.model.ValidationFailure;import org.openremote.model.ValueHolder;import org.openremote.model.value.Value;@@ -102,14 +103,14 @@ public enum AttributeValueType implements AttributeValueDescriptor {SOUND("headphone", ValueType.NUMBER, value -> Values.getNumber(value).filter(n -> n < 0).map(n -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_SOUND_OUT_OF_RANGE)),- UNIT_TYPE.withInitialValue("DB"),+ UNIT_TYPE.withInitialValue(Constants.UNITS_SOUND_DECIBELS),FORMAT.withInitialValue(Values.create("%d dB"))),TEMPERATURE("temperature-high", ValueType.NUMBER, value -> Values.getNumber(value).filter(n -> n < -273.15).map(n -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_TEMPERATURE_OUT_OF_RANGE)),- UNIT_TYPE.withInitialValue("CELSIUS"),+ UNIT_TYPE.withInitialValue(Constants.UNITS_TEMPERATURE_CELCIUS),FORMAT.withInitialValue(Values.create("%0.1f C"))),