Skip to content

armgit / core

Public Imported from GitHub
0

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

AttributeValueType updates and bug fix for GWT manager ManagerMessages translations

Rich Turnerbacb2c4e26e0
diff --git a/agent/src/main/java/org/openremote/agent/protocol/knx/TypeMapper.java b/agent/src/main/java/org/openremote/agent/protocol/knx/TypeMapper.java
index 3ea2831ab..55d637d71 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/knx/TypeMapper.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/knx/TypeMapper.java
@@ -100,10 +100,10 @@ public class TypeMapper {
dptToTypeMap.put(DPTXlator2ByteFloat.DPT_WIND_SPEED_KMH.getID(), AttributeValueType.NUMBER);
// Datapoint Types "Time", Main number 10
- dptToTypeMap.put(DPTXlatorTime.DPT_TIMEOFDAY.getID(), AttributeValueType.DATETIME);
+ dptToTypeMap.put(DPTXlatorTime.DPT_TIMEOFDAY.getID(), AttributeValueType.TIMESTAMP_ISO8601);
// Datapoint Types "Date", Main number 11
- dptToTypeMap.put(DPTXlatorDate.DPT_DATE.getID(), AttributeValueType.DATETIME);
+ dptToTypeMap.put(DPTXlatorDate.DPT_DATE.getID(), AttributeValueType.TIMESTAMP_ISO8601);
// Datapoint Types "4-Octet Unsigned Value", Main number 12
dptToTypeMap.put(DPTXlator4ByteUnsigned.DPT_VALUE_4_UCOUNT.getID(), AttributeValueType.NUMBER);
@@ -138,7 +138,7 @@ public class TypeMapper {
dptToTypeMap.put(DPTXlatorSceneControl.DPT_SCENE_CONTROL.getID(), AttributeValueType.NUMBER);
// Datapoint Types "DateTime", Main number 19
- dptToTypeMap.put(DPTXlatorDateTime.DPT_DATE_TIME.getID(), AttributeValueType.DATETIME);
+ dptToTypeMap.put(DPTXlatorDateTime.DPT_DATE_TIME.getID(), AttributeValueType.TIMESTAMP_ISO8601);
// Datapoint Types "RGB Color", Main number 232
dptToTypeMap.put(DPTXlatorRGB.DPT_RGB.getID(), AttributeValueType.COLOR_RGB);
@@ -147,7 +147,7 @@ public class TypeMapper {
typeToDptMap.put(AttributeValueType.BOOLEAN, DPTXlatorBoolean.DPT_SWITCH.getID());
typeToDptMap.put(AttributeValueType.PERCENTAGE, DPTXlator8BitUnsigned.DPT_SCALING.getID());
typeToDptMap.put(AttributeValueType.NUMBER, DPTXlator2ByteFloat.DPT_TEMPERATURE.getID());
- typeToDptMap.put(AttributeValueType.DATETIME, DPTXlatorTime.DPT_TIMEOFDAY.getID());
+ typeToDptMap.put(AttributeValueType.TIMESTAMP_ISO8601, DPTXlatorTime.DPT_TIMEOFDAY.getID());
typeToDptMap.put(AttributeValueType.STRING, DPTXlatorString.DPT_STRING_8859_1.getID());
typeToDptMap.put(AttributeValueType.COLOR_RGB, DPTXlatorRGB.DPT_RGB.getID());
}
diff --git a/agent/src/main/java/org/openremote/agent/protocol/velbus/device/ThermostatProcessor.java b/agent/src/main/java/org/openremote/agent/protocol/velbus/device/ThermostatProcessor.java
index 0515768bf..035ffe70f 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/velbus/device/ThermostatProcessor.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/velbus/device/ThermostatProcessor.java
@@ -20,7 +20,6 @@
package org.openremote.agent.protocol.velbus.device;
import org.openremote.agent.protocol.velbus.VelbusPacket;
-import org.openremote.model.Constants;
import org.openremote.model.attribute.AttributeValueType;
import org.openremote.model.util.EnumUtil;
import org.openremote.model.value.Value;
@@ -32,7 +31,6 @@ import java.util.*;
import static org.openremote.agent.protocol.velbus.AbstractVelbusProtocol.LOG;
import static org.openremote.model.Constants.UNITS_TEMPERATURE_CELCIUS;
import static org.openremote.model.Constants.UNITS_TIME_MINUTES;
-import static org.openremote.model.attribute.MetaItemType.UNIT_TYPE;
public class ThermostatProcessor extends FeatureProcessor {
@@ -143,18 +141,18 @@ public class ThermostatProcessor extends FeatureProcessor {
new PropertyDescriptor("tempAlarm3", "Temp Alarm 3", "TEMP_ALARM3", AttributeValueType.STRING, true),
new PropertyDescriptor("tempAlarm4", "Temp Alarm 4", "TEMP_ALARM4", AttributeValueType.STRING, true),
new PropertyDescriptor("tempState", "Thermostat State", "TEMP_STATE", AttributeValueType.STRING),
- new PropertyDescriptor("tempStateDisable", "Thermostat Disable (s)", "TEMP_STATE_DISABLE_SECONDS", AttributeValueType.TIME.withUnitType(UNITS_TIME_MINUTES)),
+ new PropertyDescriptor("tempStateDisable", "Thermostat Disable (s)", "TEMP_STATE_DISABLE_SECONDS", AttributeValueType.DURATION.withUnitType(UNITS_TIME_MINUTES)),
// Get current mode or set mode until next program step
new PropertyDescriptor("tempMode", "Thermostat Mode", "TEMP_MODE", AttributeValueType.STRING),
// MINS VALUE: 0 = Until next program step, -1 = Permanent, 1-65279 = for N mins
- new PropertyDescriptor("coolComfortMins", "Thermostat Cool Comfort (mins)", "TEMP_MODE_COOL_COMFORT_MINS", AttributeValueType.TIME.withUnitType(UNITS_TIME_MINUTES)),
- new PropertyDescriptor("coolDayMins", "Cool Day (mins)", "TEMP_MODE_COOL_DAY_MINS", AttributeValueType.TIME.withUnitType(UNITS_TIME_MINUTES)),
- new PropertyDescriptor("coolNightMins", "Cool Night (mins)", "TEMP_MODE_COOL_NIGHT_MINS", AttributeValueType.TIME.withUnitType(UNITS_TIME_MINUTES)),
- new PropertyDescriptor("coolSafeMins", "Cool Safe (mins)", "TEMP_MODE_COOL_SAFE_MINS", AttributeValueType.TIME.withUnitType(UNITS_TIME_MINUTES)),
- new PropertyDescriptor("heatComfortMins", "Heat Comfort (mins)", "TEMP_MODE_HEAT_COMFORT_MINS", AttributeValueType.TIME.withUnitType(UNITS_TIME_MINUTES)),
- new PropertyDescriptor("heatDayMins", "Heat Day (mins)", "TEMP_MODE_HEAT_DAY_MINS", AttributeValueType.TIME.withUnitType(UNITS_TIME_MINUTES)),
- new PropertyDescriptor("heatNightMins", "Heat Night (mins)", "TEMP_MODE_HEAT_NIGHT_MINS", AttributeValueType.TIME.withUnitType(UNITS_TIME_MINUTES)),
- new PropertyDescriptor("heatSafeMins", "Heat Safe (mins)", "TEMP_MODE_HEAT_SAFE_MINS", AttributeValueType.TIME.withUnitType(UNITS_TIME_MINUTES)),
+ new PropertyDescriptor("coolComfortMins", "Thermostat Cool Comfort (mins)", "TEMP_MODE_COOL_COMFORT_MINS", AttributeValueType.DURATION.withUnitType(UNITS_TIME_MINUTES)),
+ new PropertyDescriptor("coolDayMins", "Cool Day (mins)", "TEMP_MODE_COOL_DAY_MINS", AttributeValueType.DURATION.withUnitType(UNITS_TIME_MINUTES)),
+ new PropertyDescriptor("coolNightMins", "Cool Night (mins)", "TEMP_MODE_COOL_NIGHT_MINS", AttributeValueType.DURATION.withUnitType(UNITS_TIME_MINUTES)),
+ new PropertyDescriptor("coolSafeMins", "Cool Safe (mins)", "TEMP_MODE_COOL_SAFE_MINS", AttributeValueType.DURATION.withUnitType(UNITS_TIME_MINUTES)),
+ new PropertyDescriptor("heatComfortMins", "Heat Comfort (mins)", "TEMP_MODE_HEAT_COMFORT_MINS", AttributeValueType.DURATION.withUnitType(UNITS_TIME_MINUTES)),
+ new PropertyDescriptor("heatDayMins", "Heat Day (mins)", "TEMP_MODE_HEAT_DAY_MINS", AttributeValueType.DURATION.withUnitType(UNITS_TIME_MINUTES)),
+ new PropertyDescriptor("heatNightMins", "Heat Night (mins)", "TEMP_MODE_HEAT_NIGHT_MINS", AttributeValueType.DURATION.withUnitType(UNITS_TIME_MINUTES)),
+ new PropertyDescriptor("heatSafeMins", "Heat Safe (mins)", "TEMP_MODE_HEAT_SAFE_MINS", AttributeValueType.DURATION.withUnitType(UNITS_TIME_MINUTES)),
new PropertyDescriptor("tempTargetCurrent", "Temp Target Current", "TEMP_TARGET_CURRENT", AttributeValueType.TEMPERATURE.withUnitType(UNITS_TEMPERATURE_CELCIUS)),
new PropertyDescriptor("tempTargetCoolComfort", "Temp Target Cool Comfort", "TEMP_TARGET_COOL_COMFORT", AttributeValueType.TEMPERATURE.withUnitType(UNITS_TEMPERATURE_CELCIUS)),
new PropertyDescriptor("tempTargetCoolDay", "Temp Target Cool Day", "TEMP_TARGET_COOL_DAY", AttributeValueType.TEMPERATURE.withUnitType(UNITS_TEMPERATURE_CELCIUS)),
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.properties
index 114749a53..5e6312a0d 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
@@ -199,50 +199,31 @@ attributeValueType[OBJECT]=JSON object
attributeValueType[ARRAY]=JSON array
attributeValueType[PERCENTAGE]=Percentage
attributeValueType[LEVEL_UINT8]=Level 0-255
-attributeValueType[TIMESTAMP_MILLIS]=Timestamp milliseconds since epoch
-attributeValueType[TIMESTAMP_SECONDS]=Timestamp seconds since epoch
-attributeValueType[TIME_SECONDS]=Time seconds
-attributeValueType[TIME_MINUTES]=Time minutes
-attributeValueType[DATETIME]=Timestamp in ISO 8601
+attributeValueType[TIMESTAMP]=Timestamp
+attributeValueType[TIMESTAMP_ISO8601]=Timestamp in ISO 8601
+attributeValueType[DURATION]=Time duration
+attributeValueType[DURATION_STRING]=Time duration expression
attributeValueType[COLOR_RGB]=Color RGB
attributeValueType[COLOR_ARGB]=Color ARGB
attributeValueType[COLOR_HEX]=Color HEX
-attributeValueType[SOUND_DB]=Sound (dB)
-attributeValueType[TEMPERATURE_CELCIUS]=Temperature in Celcius
-attributeValueType[TEMPERATURE_KELVIN]=Temperature in Kelvin
-attributeValueType[TEMPERATURE_FAHRENHEIT]=Temperature in Fahrenheit
-attributeValueType[RAINFALL]=Rainfall millimetres per hour
-attributeValueType[BRIGHTNESS_LUX]=Lux brightness
-attributeValueType[DISTANCE_M]=Distance in metres
-attributeValueType[DISTANCE_CM]=Distance in centimetres
-attributeValueType[DISTANCE_MM]=Distance in millimetres
-attributeValueType[DISTANCE_IN]=Distance in inch
-attributeValueType[DISTANCE_FT]=Distance in feet
-attributeValueType[DISTANCE_YARD]=Distance in yard
-attributeValueType[SPEED_MS]=Metres per second
-attributeValueType[SPEED_KPH]=Kilometres per hour
-attributeValueType[SPEED_MPH]=Miles per hour
-attributeValueType[CO2_PPM]=CO2 Level in PPM
-attributeValueType[HUMIDITY_PERCENTAGE]=Humidity percentage
-attributeValueType[HUMIDITY_GPCM]=Humidity in grams per cubic metres
-attributeValueType[POWER_WATT]=Power in watt
-attributeValueType[POWER_KILOWATT]=Power in kilowatt
-attributeValueType[POWER_MEGAWATT]=Power in megawatt
-attributeValueType[POWER_PERCENTAGE]=Power Percentage
-attributeValueType[CHARGE_PERCENTAGE]=Charge percentage
-attributeValueType[CHARGE_KWH]=Charge in kilowatt-hours
-attributeValueType[ENERGY_KWH]=Energy in kilowatt-hours
-attributeValueType[ENERGY_JOULE]=Energy in joule
-attributeValueType[ENERGY_MEGAJOULE]=Energy in megajoule
-attributeValueType[FLOW_LPM]=Flow in litre per minute
-attributeValueType[FLOW_CMPS]=Flow in cubic metres per second
-attributeValueType[FLOW_CCMPS]=Flow in cubic centimetres per second
-attributeValueType[FLOW_CFPS]=Flow in cubic feet per second
-attributeValueType[FLOW_GPM]=Flow in gallons per minute
-attributeValueType[DIRECTION_DECIMAL_DEGREES]=Direction in decimal degrees
+attributeValueType[SOUND]=Sound level
+attributeValueType[TEMPERATURE]=Temperature
+attributeValueType[CURRENCY]=Currency
+attributeValueType[RAINFALL]=Rainfall
+attributeValueType[BRIGHTNESS]=Brightness
+attributeValueType[DISTANCE]=Distance
+attributeValueType[SPEED]=Speed
+attributeValueType[CO2]=CO2 level
+attributeValueType[HUMIDITY]=Humidity
+attributeValueType[POWER]=Power
+attributeValueType[CHARGE]=Charge level
+attributeValueType[ENERGY]=Energy level
+attributeValueType[FLOW]=Flow rate
+attributeValueType[DIRECTION]=Direction
attributeValueType[GEO_JSON_POINT]=Coordinates
attributeValueType[EMAIL]=Email
-attributeValueType[RULES_TEMPLATE_FILTER]=Rules template filter
+attributeValueType[ASSET_STATUS]=Asset status
+attributeValueType[CALENDAR_EVENT]=Calendar event
validationFailureOnAttribute=Attribute error on ''{0}''
validationFailureOnMetaItem=Meta item error on ''{0}'' meta item ''{1}''
validationFailure=Unknown validation failure.
@@ -331,6 +312,7 @@ metaItemDisplayName[urnopenremoteassetmetaattributeLink]=Attribute link
metaItemDisplayName[urnopenremoteassetmetalabel]=Label
metaItemDisplayName[urnopenremoteassetmetashowOnDashboard]=Show on dashboard
metaItemDisplayName[urnopenremoteassetmetaformat]=Format
+metaItemDisplayName[urn:openremote:asset:meta:unitType]=Units
metaItemDisplayName[urnopenremoteassetmetadescription]=Description
metaItemDisplayName[urnopenremoteassetmetaabout]=About
metaItemDisplayName[urnopenremoteassetmetareadOnly]=Read only
diff --git a/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java b/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java
index 3a4cce657..b8b147ab8 100644
--- a/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java
+++ b/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java
@@ -81,9 +81,11 @@ public enum AttributeValueType implements AttributeValueDescriptor {
TIMESTAMP("clock", ValueType.NUMBER),
- TIME("clock", ValueType.NUMBER),
+ TIMESTAMP_ISO8601("clock", ValueType.STRING),
- DATETIME("calendar-alt", ValueType.STRING),
+ DURATION("clock", ValueType.NUMBER),
+
+ DURATION_STRING("clock", ValueType.NUMBER),
COLOR_RGB("palette", ValueType.ARRAY, value -> Values.getArray(value)
.filter(array -> array.length() != 3)
@@ -156,8 +158,6 @@ public enum AttributeValueType implements AttributeValueDescriptor {
ASSET_STATUS("heart-pulse", ValueType.STRING),
- BEARING("compass", ValueType.NUMBER),
-
CALENDAR_EVENT("calendar", ValueType.OBJECT);
public enum AttributeValueTypeFailureReason implements ValidationFailure.Reason {
diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy
index cddbefe0b..5d05c0671 100644
--- a/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy
+++ b/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy
@@ -34,7 +34,7 @@ import java.util.function.Function
import static java.time.format.DateTimeFormatter.ISO_ZONED_DATE_TIME
import static org.openremote.model.asset.AssetType.THING
-import static org.openremote.model.attribute.AttributeValueType.DATETIME
+import static org.openremote.model.attribute.AttributeValueType.TIMESTAMP_ISO8601
import static org.openremote.model.query.AssetQuery.*
import static org.openremote.model.query.AssetQuery.Access.PRIVATE
import static org.openremote.model.query.AssetQuery.Access.PROTECTED
@@ -953,7 +953,7 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {
def lobby = assetStorageService.find(managerDemoSetup.lobbyId, true)
lobby.addAttributes(
- new AssetAttribute("openingDate", DATETIME, Values.create("2018-01-28T15:00:00+00:00"))
+ new AssetAttribute("openingDate", TIMESTAMP_ISO8601, Values.create("2018-01-28T15:00:00+00:00"))
)
lobby = assetStorageService.merge(lobby)