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 new ValueType for 0-255 levels (8bit unsigned int)
Eric Bariauxe816c8b75de0
diff --git a/client/src/main/resources/org/openremote/app/client/i18n/ManagerMessages.properties b/client/src/main/resources/org/openremote/app/client/i18n/ManagerMessages.propertiesindex 94bd891fa..70e61fb78 100644--- a/client/src/main/resources/org/openremote/app/client/i18n/ManagerMessages.properties+++ b/client/src/main/resources/org/openremote/app/client/i18n/ManagerMessages.properties@@ -194,6 +194,7 @@ attributeValueType[BOOLEAN]=On/Off toggleattributeValueType[OBJECT]=JSON objectattributeValueType[ARRAY]=JSON arrayattributeValueType[PERCENTAGE]=Percentage+attributeValueType[LEVEL_UINT8]=Level 0-255attributeValueType[TIMESTAMP_MILLIS]=Timestamp milliseconds since epochattributeValueType[TIMESTAMP_SECONDS]=Timestamp seconds since epochattributeValueType[DATETIME]=Timestamp in ISO 8601diff --git a/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java b/model/src/main/java/org/openremote/model/attribute/AttributeValueType.javaindex 5abd8e2c1..9b7dcc859 100644--- a/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java+++ b/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java@@ -64,6 +64,15 @@ public enum AttributeValueType implements AttributeValueDescriptor {FORMAT.withInitialValue(Values.create("%3d %%"))),+ LEVEL_UINT8("level", ValueType.NUMBER,+ value -> Values.getNumber(value)+ .filter(number -> number < 0 || number > 255)+ .map(number -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_INVALID)),+ RANGE_MIN.withInitialValue(Values.create(0)),+ RANGE_MAX.withInitialValue(Values.create(255)),+ FORMAT.withInitialValue(Values.create("%3d"))+ ),+TIMESTAMP_MILLIS("clock-o", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%d ms"))),TIMESTAMP_SECONDS("clock-o", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%d s"))),@@ -245,4 +254,4 @@ public enum AttributeValueType implements AttributeValueDescriptor {public Optional<Function<Value, Optional<ValidationFailure>>> getValidator() {return Optional.ofNullable(validator);}-}\ No newline at end of file+}