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
Simplified AttributeValueType. The unit of the attribute can be specified with MetaItemType UNIT_TYPE.
Michael Rademaker64b670c0701c
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.javaindex 50454c9f1..3ea2831ab 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@@ -79,13 +79,13 @@ public class TypeMapper {dptToTypeMap.put(DPTXlator2ByteUnsigned.DPT_BRIGHTNESS.getID(), AttributeValueType.NUMBER);// Datapoint Types "2-Octet Float Value", Main number 9- dptToTypeMap.put(DPTXlator2ByteFloat.DPT_TEMPERATURE.getID(), AttributeValueType.TEMPERATURE_CELCIUS);+ dptToTypeMap.put(DPTXlator2ByteFloat.DPT_TEMPERATURE.getID(), AttributeValueType.TEMPERATURE);dptToTypeMap.put(DPTXlator2ByteFloat.DPT_TEMPERATURE_DIFFERENCE.getID(), AttributeValueType.NUMBER);dptToTypeMap.put(DPTXlator2ByteFloat.DPT_TEMPERATURE_GRADIENT.getID(), AttributeValueType.NUMBER);dptToTypeMap.put(DPTXlator2ByteFloat.DPT_INTENSITY_OF_LIGHT.getID(), AttributeValueType.NUMBER);dptToTypeMap.put(DPTXlator2ByteFloat.DPT_WIND_SPEED.getID(), AttributeValueType.NUMBER);dptToTypeMap.put(DPTXlator2ByteFloat.DPT_AIR_PRESSURE.getID(), AttributeValueType.NUMBER);- dptToTypeMap.put(DPTXlator2ByteFloat.DPT_HUMIDITY.getID(), AttributeValueType.HUMIDITY_PERCENTAGE);+ dptToTypeMap.put(DPTXlator2ByteFloat.DPT_HUMIDITY.getID(), AttributeValueType.HUMIDITY);dptToTypeMap.put(DPTXlator2ByteFloat.DPT_AIRQUALITY.getID(), AttributeValueType.NUMBER);dptToTypeMap.put(DPTXlator2ByteFloat.DPT_TIME_DIFFERENCE1.getID(), AttributeValueType.NUMBER);dptToTypeMap.put(DPTXlator2ByteFloat.DPT_TIME_DIFFERENCE2.getID(), AttributeValueType.NUMBER);diff --git a/agent/src/main/java/org/openremote/agent/protocol/velbus/AbstractVelbusProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/velbus/AbstractVelbusProtocol.javaindex e3e21b23b..0c532cab8 100644--- a/agent/src/main/java/org/openremote/agent/protocol/velbus/AbstractVelbusProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/velbus/AbstractVelbusProtocol.java@@ -367,7 +367,7 @@ public abstract class AbstractVelbusProtocol extends AbstractProtocol implementsnew LinkedAttributeDescriptor(propertyDescriptor.getName(),propertyDescriptor.getDisplayName(),- propertyDescriptor.getAttributeValueType(),+ propertyDescriptor.getAttributeValueDescriptor(),propertyDescriptor.isReadOnly(),false,createLinkedAttributeMetaItems(diff --git a/agent/src/main/java/org/openremote/agent/protocol/velbus/device/AnalogInputProcessor.java b/agent/src/main/java/org/openremote/agent/protocol/velbus/device/AnalogInputProcessor.javaindex 2b2f939e2..d6e9397ea 100644--- a/agent/src/main/java/org/openremote/agent/protocol/velbus/device/AnalogInputProcessor.java+++ b/agent/src/main/java/org/openremote/agent/protocol/velbus/device/AnalogInputProcessor.java@@ -116,8 +116,8 @@ public class AnalogInputProcessor extends FeatureProcessor {protected static final List<PropertyDescriptor> METEO_PROPERTIES = Arrays.asList(new PropertyDescriptor("rainfall", "Rainfall", "RAINFALL", AttributeValueType.RAINFALL, true),- new PropertyDescriptor("lightLevel", "Light Level", "LIGHT", AttributeValueType.BRIGHTNESS_LUX, true),- new PropertyDescriptor("windSpeed", "Wind Speed", "WIND", AttributeValueType.SPEED_KPH, true)+ new PropertyDescriptor("lightLevel", "Light Level", "LIGHT", AttributeValueType.BRIGHTNESS, true),+ new PropertyDescriptor("windSpeed", "Wind Speed", "WIND", AttributeValueType.SPEED, true));protected static final List<PropertyDescriptor> IO_PROPERTIES = Arrays.asList(diff --git a/agent/src/main/java/org/openremote/agent/protocol/velbus/device/FeatureProcessor.java b/agent/src/main/java/org/openremote/agent/protocol/velbus/device/FeatureProcessor.javaindex 908f5d52c..4cf6689d9 100644--- a/agent/src/main/java/org/openremote/agent/protocol/velbus/device/FeatureProcessor.java+++ b/agent/src/main/java/org/openremote/agent/protocol/velbus/device/FeatureProcessor.java@@ -20,6 +20,7 @@package org.openremote.agent.protocol.velbus.device;import org.openremote.agent.protocol.velbus.VelbusPacket;+import org.openremote.model.attribute.AttributeValueDescriptor;import org.openremote.model.attribute.AttributeValueType;import org.openremote.model.util.EnumUtil;import org.openremote.model.value.Value;@@ -41,27 +42,27 @@ public abstract class FeatureProcessor {protected final String name;protected final String displayName;protected final String linkName;- protected final AttributeValueType attributeValueType;+ protected final AttributeValueDescriptor attributeValueDescriptor;protected final boolean readOnly;public PropertyDescriptor(String name,String displayName,String linkName,- AttributeValueType attributeValueType) {- this(name, displayName, linkName, attributeValueType, false);+ AttributeValueDescriptor attributeValueDescriptor) {+ this(name, displayName, linkName, attributeValueDescriptor, false);}public PropertyDescriptor(String name,String displayName,String linkName,- AttributeValueType attributeValueType,+ AttributeValueDescriptor attributeValueDescriptor,boolean readOnly) {this.name = name;this.displayName = displayName;this.linkName = linkName;- this.attributeValueType = attributeValueType;+ this.attributeValueDescriptor = attributeValueDescriptor;this.readOnly = readOnly;}@@ -73,8 +74,8 @@ public abstract class FeatureProcessor {return displayName;}- public AttributeValueType getAttributeValueType() {- return attributeValueType;+ public AttributeValueDescriptor getAttributeValueDescriptor() {+ return attributeValueDescriptor;}public boolean isReadOnly() {diff --git a/agent/src/main/java/org/openremote/agent/protocol/velbus/device/TemperatureProcessor.java b/agent/src/main/java/org/openremote/agent/protocol/velbus/device/TemperatureProcessor.javaindex aff371993..3deb24e82 100644--- a/agent/src/main/java/org/openremote/agent/protocol/velbus/device/TemperatureProcessor.java+++ b/agent/src/main/java/org/openremote/agent/protocol/velbus/device/TemperatureProcessor.java@@ -29,9 +29,9 @@ import java.util.List;public class TemperatureProcessor extends FeatureProcessor {protected static final List<PropertyDescriptor> SUPPORTED_PROPERTIES = Arrays.asList(- new PropertyDescriptor("tempCurrent", "Temp Current", "TEMP_CURRENT", AttributeValueType.TEMPERATURE_CELCIUS, true),- new PropertyDescriptor("tempMin", "Temp Min", "TEMP_MIN", AttributeValueType.TEMPERATURE_CELCIUS, true),- new PropertyDescriptor("tempMax", "Temp Max", "TEMP_MAX", AttributeValueType.TEMPERATURE_CELCIUS, true)+ new PropertyDescriptor("tempCurrent", "Temp Current", "TEMP_CURRENT", AttributeValueType.TEMPERATURE, true),+ new PropertyDescriptor("tempMin", "Temp Min", "TEMP_MIN", AttributeValueType.TEMPERATURE, true),+ new PropertyDescriptor("tempMax", "Temp Max", "TEMP_MAX", AttributeValueType.TEMPERATURE, true));@Overridediff --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.javaindex f05963054..c15bee9bc 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@@ -29,6 +29,7 @@ import org.openremote.model.value.Values;import java.util.*;import static org.openremote.agent.protocol.velbus.AbstractVelbusProtocol.LOG;+import static org.openremote.model.attribute.MetaItemType.UNIT_TYPE;public class ThermostatProcessor extends FeatureProcessor {@@ -139,27 +140,27 @@ 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_SECONDS),+ new PropertyDescriptor("tempStateDisable", "Thermostat Disable (s)", "TEMP_STATE_DISABLE_SECONDS", AttributeValueType.TIME.withUnitType(UNIT_TYPE.withInitialValue("SECONDS"))),// Get current mode or set mode until next program stepnew 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_MINUTES),- new PropertyDescriptor("coolDayMins", "Cool Day (mins)", "TEMP_MODE_COOL_DAY_MINS", AttributeValueType.TIME_MINUTES),- new PropertyDescriptor("coolNightMins", "Cool Night (mins)", "TEMP_MODE_COOL_NIGHT_MINS", AttributeValueType.TIME_MINUTES),- new PropertyDescriptor("coolSafeMins", "Cool Safe (mins)", "TEMP_MODE_COOL_SAFE_MINS", AttributeValueType.TIME_MINUTES),- new PropertyDescriptor("heatComfortMins", "Heat Comfort (mins)", "TEMP_MODE_HEAT_COMFORT_MINS", AttributeValueType.TIME_MINUTES),- new PropertyDescriptor("heatDayMins", "Heat Day (mins)", "TEMP_MODE_HEAT_DAY_MINS", AttributeValueType.TIME_MINUTES),- new PropertyDescriptor("heatNightMins", "Heat Night (mins)", "TEMP_MODE_HEAT_NIGHT_MINS", AttributeValueType.TIME_MINUTES),- new PropertyDescriptor("heatSafeMins", "Heat Safe (mins)", "TEMP_MODE_HEAT_SAFE_MINS", AttributeValueType.TIME_MINUTES),- new PropertyDescriptor("tempTargetCurrent", "Temp Target Current", "TEMP_TARGET_CURRENT", AttributeValueType.TEMPERATURE_CELCIUS),- new PropertyDescriptor("tempTargetCoolComfort", "Temp Target Cool Comfort", "TEMP_TARGET_COOL_COMFORT", AttributeValueType.TEMPERATURE_CELCIUS),- new PropertyDescriptor("tempTargetCoolDay", "Temp Target Cool Day", "TEMP_TARGET_COOL_DAY", AttributeValueType.TEMPERATURE_CELCIUS),- new PropertyDescriptor("tempTargetCoolNight", "Temp Target Cool Night", "TEMP_TARGET_COOL_NIGHT", AttributeValueType.TEMPERATURE_CELCIUS),- new PropertyDescriptor("tempTargetCoolSafe", "Temp Target Cool Safe", "TEMP_TARGET_COOL_SAFE", AttributeValueType.TEMPERATURE_CELCIUS),- new PropertyDescriptor("tempTargetHeatComfort", "Temp Target Heat Comfort", "TEMP_TARGET_HEAT_COMFORT", AttributeValueType.TEMPERATURE_CELCIUS),- new PropertyDescriptor("tempTargetHeatDay", "Temp Target Heat Day", "TEMP_TARGET_HEAT_DAY", AttributeValueType.TEMPERATURE_CELCIUS),- new PropertyDescriptor("tempTargetHeatNight", "Temp Target Heat Night", "TEMP_TARGET_HEAT_NIGHT", AttributeValueType.TEMPERATURE_CELCIUS),- new PropertyDescriptor("tempTargetHeatSafe", "Temp Target Heat Safe", "TEMP_TARGET_HEAT_SAFE", AttributeValueType.TEMPERATURE_CELCIUS)+ new PropertyDescriptor("coolComfortMins", "Thermostat Cool Comfort (mins)", "TEMP_MODE_COOL_COMFORT_MINS", AttributeValueType.TIME.withUnitType(UNIT_TYPE.withInitialValue("MINUTES"))),+ new PropertyDescriptor("coolDayMins", "Cool Day (mins)", "TEMP_MODE_COOL_DAY_MINS", AttributeValueType.TIME.withUnitType(UNIT_TYPE.withInitialValue("MINUTES"))),+ new PropertyDescriptor("coolNightMins", "Cool Night (mins)", "TEMP_MODE_COOL_NIGHT_MINS", AttributeValueType.TIME.withUnitType(UNIT_TYPE.withInitialValue("MINUTES"))),+ new PropertyDescriptor("coolSafeMins", "Cool Safe (mins)", "TEMP_MODE_COOL_SAFE_MINS", AttributeValueType.TIME.withUnitType(UNIT_TYPE.withInitialValue("MINUTES"))),+ new PropertyDescriptor("heatComfortMins", "Heat Comfort (mins)", "TEMP_MODE_HEAT_COMFORT_MINS", AttributeValueType.TIME.withUnitType(UNIT_TYPE.withInitialValue("MINUTES"))),+ new PropertyDescriptor("heatDayMins", "Heat Day (mins)", "TEMP_MODE_HEAT_DAY_MINS", AttributeValueType.TIME.withUnitType(UNIT_TYPE.withInitialValue("MINUTES"))),+ new PropertyDescriptor("heatNightMins", "Heat Night (mins)", "TEMP_MODE_HEAT_NIGHT_MINS", AttributeValueType.TIME.withUnitType(UNIT_TYPE.withInitialValue("MINUTES"))),+ new PropertyDescriptor("heatSafeMins", "Heat Safe (mins)", "TEMP_MODE_HEAT_SAFE_MINS", AttributeValueType.TIME.withUnitType(UNIT_TYPE.withInitialValue("MINUTES"))),+ new PropertyDescriptor("tempTargetCurrent", "Temp Target Current", "TEMP_TARGET_CURRENT", AttributeValueType.TEMPERATURE.withUnitType(UNIT_TYPE.withInitialValue("CELCIUS"))),+ new PropertyDescriptor("tempTargetCoolComfort", "Temp Target Cool Comfort", "TEMP_TARGET_COOL_COMFORT", AttributeValueType.TEMPERATURE.withUnitType(UNIT_TYPE.withInitialValue("CELCIUS"))),+ new PropertyDescriptor("tempTargetCoolDay", "Temp Target Cool Day", "TEMP_TARGET_COOL_DAY", AttributeValueType.TEMPERATURE.withUnitType(UNIT_TYPE.withInitialValue("CELCIUS"))),+ new PropertyDescriptor("tempTargetCoolNight", "Temp Target Cool Night", "TEMP_TARGET_COOL_NIGHT", AttributeValueType.TEMPERATURE.withUnitType(UNIT_TYPE.withInitialValue("CELCIUS"))),+ new PropertyDescriptor("tempTargetCoolSafe", "Temp Target Cool Safe", "TEMP_TARGET_COOL_SAFE", AttributeValueType.TEMPERATURE.withUnitType(UNIT_TYPE.withInitialValue("CELCIUS"))),+ new PropertyDescriptor("tempTargetHeatComfort", "Temp Target Heat Comfort", "TEMP_TARGET_HEAT_COMFORT", AttributeValueType.TEMPERATURE.withUnitType(UNIT_TYPE.withInitialValue("CELCIUS"))),+ new PropertyDescriptor("tempTargetHeatDay", "Temp Target Heat Day", "TEMP_TARGET_HEAT_DAY", AttributeValueType.TEMPERATURE.withUnitType(UNIT_TYPE.withInitialValue("CELCIUS"))),+ new PropertyDescriptor("tempTargetHeatNight", "Temp Target Heat Night", "TEMP_TARGET_HEAT_NIGHT", AttributeValueType.TEMPERATURE.withUnitType(UNIT_TYPE.withInitialValue("CELCIUS"))),+ new PropertyDescriptor("tempTargetHeatSafe", "Temp Target Heat Safe", "TEMP_TARGET_HEAT_SAFE", AttributeValueType.TEMPERATURE.withUnitType(UNIT_TYPE.withInitialValue("CELCIUS"))));@Overridediff --git a/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java b/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.javaindex 52101d64a..e4761a93f 100644--- a/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java+++ b/manager/src/main/java/org/openremote/manager/setup/AbstractManagerSetup.java@@ -98,7 +98,7 @@ public abstract class AbstractManagerSetup implements Setup {new MetaItem(STORE_DATA_POINTS, Values.create(true)),new MetaItem(SHOW_ON_DASHBOARD, Values.create(true)))),- new AssetAttribute("vacationUntil", TIMESTAMP_MILLIS)+ new AssetAttribute("vacationUntil", TIMESTAMP).setMeta(new Meta(new MetaItem(LABEL, Values.create("Vacation until")),new MetaItem(DESCRIPTION, Values.create("Vacation mode enabled until")),@@ -161,13 +161,13 @@ public abstract class AbstractManagerSetup implements Setup {new MetaItem(STORE_DATA_POINTS, Values.create(true)),new MetaItem(SHOW_ON_DASHBOARD, Values.create(true))),- new AssetAttribute("firstPresenceDetected", TIMESTAMP_MILLIS)+ new AssetAttribute("firstPresenceDetected", TIMESTAMP).setMeta(new MetaItem(LABEL, Values.create("First time movement was detected")),new MetaItem(READ_ONLY, Values.create(true)),new MetaItem(RULE_STATE, Values.create(true))),- new AssetAttribute("lastPresenceDetected", TIMESTAMP_MILLIS)+ new AssetAttribute("lastPresenceDetected", TIMESTAMP).setMeta(new MetaItem(LABEL, Values.create("Last time movement was detected")),new MetaItem(READ_ONLY, Values.create(true)),@@ -178,7 +178,7 @@ public abstract class AbstractManagerSetup implements Setup {protected void addDemoApartmentRoomCO2Sensor(Asset room, boolean shouldBeLinked, Supplier<MetaItem[]> agentLinker) {room.addAttributes(- new AssetAttribute("co2Level", CO2_PPM)+ new AssetAttribute("co2Level", CO2).setMeta(new MetaItem(LABEL, Values.create("CO2 level")),new MetaItem(RULE_STATE, Values.create(true)),@@ -195,7 +195,7 @@ public abstract class AbstractManagerSetup implements Setup {protected void addDemoApartmentRoomHumiditySensor(Asset room, boolean shouldBeLinked, Supplier<MetaItem[]> agentLinker) {room.addAttributes(- new AssetAttribute("humidity", HUMIDITY_PERCENTAGE)+ new AssetAttribute("humidity", HUMIDITY).setMeta(new MetaItem(LABEL, Values.create("Humidity")),new MetaItem(RULE_STATE, Values.create(true)),@@ -214,13 +214,14 @@ public abstract class AbstractManagerSetup implements Setup {boolean shouldBeLinked,Supplier<MetaItem[]> agentLinker) {room.addAttributes(- new AssetAttribute("currentTemperature", TEMPERATURE_CELCIUS)+ new AssetAttribute("currentTemperature", TEMPERATURE).setMeta(new MetaItem(LABEL, Values.create("Current temperature")),new MetaItem(RULE_STATE, Values.create(true)),new MetaItem(ACCESS_RESTRICTED_READ, Values.create(true)),new MetaItem(READ_ONLY, Values.create(true)),new MetaItem(SHOW_ON_DASHBOARD, Values.create(true)),+ new MetaItem(UNIT_TYPE, Values.create("CELSIUS")),new MetaItem(FORMAT, Values.create("%0.1f° C")),new MetaItem(STORE_DATA_POINTS)).addMeta(shouldBeLinked ? agentLinker.get() : null)@@ -231,13 +232,14 @@ public abstract class AbstractManagerSetup implements Setup {boolean shouldBeLinked,Supplier<MetaItem[]> agentLinker) {room.addAttributes(- new AssetAttribute("targetTemperature", TEMPERATURE_CELCIUS)+ new AssetAttribute("targetTemperature", TEMPERATURE).setMeta(new MetaItem(LABEL, Values.create("Target temperature")),new MetaItem(RULE_STATE, Values.create(true)),new MetaItem(ACCESS_RESTRICTED_READ, Values.create(true)),new MetaItem(ACCESS_RESTRICTED_WRITE, Values.create(true)),new MetaItem(SHOW_ON_DASHBOARD, Values.create(true)),+ new MetaItem(UNIT_TYPE, Values.create("CELSIUS")),new MetaItem(FORMAT, Values.create("%0f° C")),new MetaItem(STORE_DATA_POINTS)).addMeta(shouldBeLinked ? agentLinker.get() : null)@@ -268,7 +270,7 @@ public abstract class AbstractManagerSetup implements Setup {new MetaItem(RULE_EVENT_EXPIRES, Values.create("48h"))).addMeta(shouldBeLinked ? agentLinker.apply(0) : null),// Time- new AssetAttribute("smartSwitchBeginEnd" + switchName, TIMESTAMP_MILLIS)+ new AssetAttribute("smartSwitchBeginEnd" + switchName, TIMESTAMP).setMeta(new MetaItem(LABEL, Values.create("Smart Switch begin/end cycle " + switchName)),new MetaItem(DESCRIPTION, Values.create("User-provided begin/end time of appliance cycle")),@@ -277,19 +279,21 @@ public abstract class AbstractManagerSetup implements Setup {new MetaItem(RULE_STATE, Values.create(true))).addMeta(shouldBeLinked ? agentLinker.apply(1) : null),// StartTime- new AssetAttribute("smartSwitchStartTime" + switchName, TIMESTAMP_SECONDS)+ new AssetAttribute("smartSwitchStartTime" + switchName, TIMESTAMP).setMeta(new MetaItem(LABEL, Values.create("Smart Switch actuator earliest start time " + switchName)),new MetaItem(DESCRIPTION, Values.create("Earliest computed start time sent to actuator")),new MetaItem(READ_ONLY, Values.create(true)),+ new MetaItem(UNIT_TYPE, Values.create("SECONDS")),new MetaItem(RULE_STATE, Values.create(true))).addMeta(shouldBeLinked ? agentLinker.apply(2) : null),// StopTime- new AssetAttribute("smartSwitchStopTime" + switchName, TIMESTAMP_SECONDS)+ new AssetAttribute("smartSwitchStopTime" + switchName, TIMESTAMP).setMeta(new MetaItem(LABEL, Values.create("Smart Switch actuator latest stop time " + switchName)),new MetaItem(DESCRIPTION, Values.create("Latest computed stop time sent to actuator")),new MetaItem(READ_ONLY, Values.create(true)),+ new MetaItem(UNIT_TYPE, Values.create("SECONDS")),new MetaItem(RULE_STATE, Values.create(true))).addMeta(shouldBeLinked ? agentLinker.apply(3) : null),// Enabled@@ -573,7 +577,7 @@ public abstract class AbstractManagerSetup implements Setup {Asset microphoneAsset = new Asset(name, MICROPHONE, area);microphoneAsset.setAttributes(new AssetAttribute(AttributeType.LOCATION, location.toValue()),- new AssetAttribute("microphoneLevel", SOUND_DB)+ new AssetAttribute("microphoneLevel", SOUND).setMeta(new MetaItem(LABEL, Values.create("Microphone Level")),new MetaItem(DESCRIPTION, Values.create("dB")),@@ -636,12 +640,13 @@ public abstract class AbstractManagerSetup implements Setup {Asset environmentAsset = new Asset(name, ENVIRONMENT_SENSOR, area);environmentAsset.setAttributes(new AssetAttribute(AttributeType.LOCATION, location.toValue()),- new AssetAttribute("temperature", TEMPERATURE_CELCIUS)+ new AssetAttribute("temperature", TEMPERATURE).setMeta(- new MetaItem(LABEL, Values.create("Tempature Level")),+ new MetaItem(LABEL, Values.create("Temperature Level")),new MetaItem(DESCRIPTION, Values.create("oC")),new MetaItem(READ_ONLY, Values.create(true)),new MetaItem(RULE_STATE, Values.create(true)),+ new MetaItem(UNIT_TYPE, Values.create("CELSIUS")),new MetaItem(STORE_DATA_POINTS)).addMeta(agentLinker.get()),new AssetAttribute("nO2", NUMBER)diff --git a/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.java b/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.javaindex 01692fa6e..b5f5e6fed 100644--- a/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.java+++ b/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.java@@ -233,7 +233,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {SimulatorProtocol.SIMULATOR_ELEMENT, Values.create(ColorSimulatorElement.ELEMENT_NAME)))),- new AssetAttribute("light1PowerConsumption", ENERGY_KWH, Values.create(12.345))+ new AssetAttribute("light1PowerConsumption", ENERGY, Values.create(12.345)).setMeta(new Meta(new MetaItem(LABEL,@@ -611,19 +611,19 @@ public class ManagerDemoSetup extends AbstractManagerSetup {new MetaItem(DESCRIPTION, Values.create("Someone is currently present in the room")),new MetaItem(RULE_STATE, Values.create(true))),- new AssetAttribute("firstPresenceDetected", AttributeValueType.TIMESTAMP_MILLIS)+ new AssetAttribute("firstPresenceDetected", AttributeValueType.TIMESTAMP).setMeta(new MetaItem(LABEL, Values.create("First Presence Timestamp")),new MetaItem(DESCRIPTION, Values.create("Timestamp of the first detected presence")),new MetaItem(RULE_STATE, Values.create(true))),- new AssetAttribute("lastPresenceDetected", AttributeValueType.TIMESTAMP_MILLIS)+ new AssetAttribute("lastPresenceDetected", AttributeValueType.TIMESTAMP).setMeta(new MetaItem(LABEL, Values.create("Last Presence Timestamp")),new MetaItem(DESCRIPTION, Values.create("Timestamp of last detected presence")),new MetaItem(RULE_STATE, Values.create(true))),- new AssetAttribute("co2Level", AttributeValueType.CO2_PPM, Values.create(350))+ new AssetAttribute("co2Level", AttributeValueType.CO2, Values.create(350)).setMeta(new MetaItem(LABEL, Values.create("CO2 Level")),new MetaItem(RULE_STATE, Values.create(true))@@ -667,13 +667,13 @@ public class ManagerDemoSetup extends AbstractManagerSetup {new MetaItem(DESCRIPTION, Values.create("Someone is currently present in the room")),new MetaItem(RULE_STATE, Values.create(true))),- new AssetAttribute("firstPresenceDetected", AttributeValueType.TIMESTAMP_MILLIS)+ new AssetAttribute("firstPresenceDetected", AttributeValueType.TIMESTAMP).setMeta(new MetaItem(LABEL, Values.create("First Presence Timestamp")),new MetaItem(DESCRIPTION, Values.create("Timestamp of the first detected presence")),new MetaItem(RULE_STATE, Values.create(true))),- new AssetAttribute("lastPresenceDetected", AttributeValueType.TIMESTAMP_MILLIS)+ new AssetAttribute("lastPresenceDetected", AttributeValueType.TIMESTAMP).setMeta(new MetaItem(LABEL, Values.create("Last Presence Timestamp")),new MetaItem(DESCRIPTION, Values.create("Timestamp of last detected presence")),diff --git a/model/src/main/java/org/openremote/model/asset/AssetAttribute.java b/model/src/main/java/org/openremote/model/asset/AssetAttribute.javaindex a1ee3238a..35302fd24 100644--- a/model/src/main/java/org/openremote/model/asset/AssetAttribute.java+++ b/model/src/main/java/org/openremote/model/asset/AssetAttribute.java@@ -460,11 +460,11 @@ public class AssetAttribute extends Attribute {return copy;}- public void setSpecificType(String specificType) {- if (!isNullOrEmpty(specificType)) {- replaceMetaByName(getMeta(), SPECIFIC_TYPE, Values.create(specificType));+ public void setUnitType(String unitType) {+ if (!isNullOrEmpty(unitType)) {+ replaceMetaByName(getMeta(), UNIT_TYPE, Values.create(unitType));} else {- getMeta().removeIf(isMetaNameEqualTo(SPECIFIC_TYPE));+ getMeta().removeIf(isMetaNameEqualTo(UNIT_TYPE));}}diff --git a/model/src/main/java/org/openremote/model/asset/AssetType.java b/model/src/main/java/org/openremote/model/asset/AssetType.javaindex 9d0a7671f..ee51f4730 100644--- a/model/src/main/java/org/openremote/model/asset/AssetType.java+++ b/model/src/main/java/org/openremote/model/asset/AssetType.java@@ -65,7 +65,7 @@ public enum AssetType implements AssetDescriptor {CONSOLE(ASSET_NAMESPACE + ":console", "monitor-cellphone", null),MICROPHONE(ASSET_NAMESPACE + ":microphone", "microphone", "47A5FF",- new AttributeDescriptorImpl("microphoneLevel", SOUND_DB, Values.create(0),+ new AttributeDescriptorImpl("microphoneLevel", SOUND, Values.create(0),LABEL.withInitialValue(Values.create("Microphone Level")),DESCRIPTION.withInitialValue(Values.create("DB")),READ_ONLY,@@ -102,7 +102,7 @@ public enum AssetType implements AssetDescriptor {),ENVIRONMENT_SENSOR(ASSET_NAMESPACE + ":enviroment", "periodic-table-co2", "f18546",- new AttributeDescriptorImpl("temperature", TEMPERATURE_CELCIUS, Values.create(0),+ new AttributeDescriptorImpl("temperature", TEMPERATURE, Values.create(0),LABEL.withInitialValue(Values.create("Temperature")),DESCRIPTION.withInitialValue(Values.create("Temperature in celcius")),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.javaindex cedd90ae1..f6dfdc8c6 100644--- a/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java+++ b/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java@@ -26,6 +26,8 @@ import org.openremote.model.value.Value;import org.openremote.model.value.ValueType;import org.openremote.model.value.Values;+import java.util.Arrays;+import java.util.List;import java.util.Optional;import java.util.function.Function;@@ -68,145 +70,84 @@ public enum AttributeValueType implements AttributeValueDescriptor {),LEVEL_UINT8("ruler-vertical", 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"))+ 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", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%d ms"))),-- TIMESTAMP_SECONDS("clock", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%d s"))),+ TIMESTAMP("clock", ValueType.NUMBER),- TIME_SECONDS("clock", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f s"))),-- TIME_MINUTES("clock", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f min"))),+ TIME("clock", ValueType.NUMBER),DATETIME("calendar-alt", ValueType.STRING),COLOR_RGB("palette", ValueType.ARRAY, value -> Values.getArray(value)- .filter(array -> array.length() != 3)- .map(array -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_INVALID_COLOR_FORMAT))+ .filter(array -> array.length() != 3)+ .map(array -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_INVALID_COLOR_FORMAT))),COLOR_ARGB("palette", ValueType.ARRAY, value -> Values.getArray(value)- .filter(array -> array.length() != 4)- .map(array -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_INVALID_COLOR_FORMAT))+ .filter(array -> array.length() != 4)+ .map(array -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_INVALID_COLOR_FORMAT))),COLOR_HEX("palette", ValueType.STRING, value -> Values.getString(value)- .filter(s -> !s.matches("[a-fA-F0-9]{6}"))- .map(array -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_INVALID_COLOR_FORMAT))- ),-- SOUND_DB("headphone", ValueType.NUMBER, value -> Values.getNumber(value)- .filter(n -> n < 0)- .map(n -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_SOUND_OUT_OF_RANGE)),- FORMAT.withInitialValue(Values.create("%d dB"))- ),-- TEMPERATURE_CELCIUS("temperature-high", ValueType.NUMBER, value -> Values.getNumber(value)- .filter(n -> n < -273.15)- .map(n -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_TEMPERATURE_OUT_OF_RANGE)),- FORMAT.withInitialValue(Values.create("%0.1f C")- )+ .filter(s -> !s.matches("[a-fA-F0-9]{6}"))+ .map(array -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_INVALID_COLOR_FORMAT))),- TEMPERATURE_KELVIN("temperature-high", ValueType.NUMBER, value -> Values.getNumber(value)- .filter(n -> n < 0)- .map(n -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_TEMPERATURE_OUT_OF_RANGE))+ 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"),+ FORMAT.withInitialValue(Values.create("%d dB"))),- TEMPERATURE_FAHRENHEIT("temperature-high", ValueType.NUMBER, value -> Values.getNumber(value)- .filter(n -> n < -459.67)- .map(n -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_TEMPERATURE_OUT_OF_RANGE))+ 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"),+ FORMAT.withInitialValue(Values.create("%0.1f C")+ )),- CURRENCY("money", ValueType.NUMBER, SPECIFIC_TYPE.withInitialValue(Values.create("EUR"))),-- RAINFALL("water", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f mm/h"))),-- BRIGHTNESS_LUX("lightbulb", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%d lx"))),+ CURRENCY("money", ValueType.NUMBER),- DISTANCE_M("ruler", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f m"))),+ RAINFALL("water", ValueType.NUMBER),- DISTANCE_CM("ruler", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f cm"))),+ BRIGHTNESS("lightbulb", ValueType.NUMBER),- DISTANCE_MM("ruler", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f mm"))),+ DISTANCE("ruler", ValueType.NUMBER),- DISTANCE_IN("ruler", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f \""))),+ SPEED("circle", ValueType.NUMBER),- DISTANCE_FT("ruler", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f '"))),+ CO2("leaf", ValueType.NUMBER),- DISTANCE_YARD("ruler", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f yd"))),+ HUMIDITY("water", ValueType.NUMBER),- SPEED_MS("circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.3f m/s"))),+ POWER("bolt", ValueType.NUMBER),- SPEED_KPH("circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f km/h"))),-- SPEED_MPH("circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f mi/h"))),-- SPEED_KNOTS("circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f knots"))),-- CO2_PPM("leaf", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%4d ppm"))),-- CO2_KG("leaf", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f kg"))),-- HUMIDITY_PERCENTAGE("water", ValueType.NUMBER, value -> Values.getNumber(value)- .filter(number -> number < 0 || number > 100)- .map(number -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_PERCENTAGE_OUT_OF_RANGE)),- RANGE_MIN.withInitialValue(Values.create(0)),- RANGE_MAX.withInitialValue(Values.create(100)),- FORMAT.withInitialValue(Values.create("%3d %%"))+ CHARGE("battery-half", ValueType.NUMBER, value -> Values.getNumber(value)+ .filter(number -> number < 0 || number > 100)+ .map(number -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_PERCENTAGE_OUT_OF_RANGE)),+ RANGE_MIN.withInitialValue(Values.create(0)),+ RANGE_MAX.withInitialValue(Values.create(100))),- HUMIDITY_GPCM("water", ValueType.NUMBER),-- POWER_WATT("bolt", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f W"))),-- POWER_KILOWATT("bolt", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f KW"))),+ ENERGY("plug", ValueType.NUMBER),- POWER_MEGAWATT("bolt", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f MW"))),+ FLOW("dot-circle", ValueType.NUMBER),- POWER_PERCENTAGE("bolt", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%3d %%"))),-- CHARGE_PERCENTAGE("battery-half", ValueType.NUMBER, value -> Values.getNumber(value)- .filter(number -> number < 0 || number > 100)- .map(number -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_PERCENTAGE_OUT_OF_RANGE)),- RANGE_MIN.withInitialValue(Values.create(0)),- RANGE_MAX.withInitialValue(Values.create(100)),- FORMAT.withInitialValue(Values.create("%3d %%"))- ),-- CHARGE_KWH("battery-half", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f KWh"))),-- ENERGY_KWH("plug", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f KWh"))),-- ENERGY_JOULE("plug", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f J"))),-- ENERGY_MEGAJOULE("plug", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f MJ"))),-- ENERGY_CARBON("leaf", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f kg CO2/kWH"))),-- FLOW_LPM("dot-circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f L/m"))),-- FLOW_CMPS("dot-circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f m³/s"))),-- FLOW_CCMPS("dot-circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f cm³/s"))),-- FLOW_CFPS("dot-circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f cfs"))),-- FLOW_GPM("dot-circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f gpm"))),-- DIRECTION_DECIMAL_DEGREES("compass", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f deg"))),+ DIRECTION("compass", ValueType.NUMBER),GEO_JSON_POINT("map-marker-alt", ValueType.OBJECT),EMAIL("at", ValueType.STRING, value -> Values.getString(value)- .filter(s -> !s.matches("(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"))- .map(array -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_INVALID_EMAIL_FORMAT))+ .filter(s -> !s.matches("(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"))+ .map(array -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_INVALID_EMAIL_FORMAT))),// TODO Implement "Saved Filter/Searches" properly, see AssetResourceImpl@@ -221,12 +162,13 @@ public enum AttributeValueType implements AttributeValueDescriptor {public enum AttributeValueTypeFailureReason implements ValidationFailure.Reason {ATTRIBUTE_TYPE_VALUE_DOES_NOT_MATCH}+public static final String DEFAULT_ICON = "circle";final protected String icon;final protected ValueType valueType;@JsonIgnore- final protected Function<Value, Optional<ValidationFailure>> validator;- final protected MetaItemDescriptor[] metaItemDescriptors;+ protected Function<Value, Optional<ValidationFailure>> validator;+ protected MetaItemDescriptor[] metaItemDescriptors;AttributeValueType(String icon, ValueType valueType, MetaItemDescriptor... metaItemDescriptors) {this(icon, valueType, null, metaItemDescriptors);@@ -274,4 +216,12 @@ public enum AttributeValueType implements AttributeValueDescriptor {public Optional<Function<Value, Optional<ValidationFailure>>> getValidator() {return Optional.ofNullable(validator);}++ public AttributeValueDescriptor withUnitType(MetaItemDescriptor unitType) {+ if (unitType.getUrn().equals(UNIT_TYPE.getUrn())) {+ return new AttributeValueDescriptorImpl(getName(), getIcon(), getValueType(), new MetaItemDescriptor[]{unitType});+ } else {+ throw new IllegalArgumentException("Parameter unitType should be of MetaItem type: " + UNIT_TYPE.getUrn());+ }+ }}diff --git a/model/src/main/java/org/openremote/model/attribute/LinkedAttributeDescriptor.java b/model/src/main/java/org/openremote/model/attribute/LinkedAttributeDescriptor.javaindex 880ee8782..208eb5dcf 100644--- a/model/src/main/java/org/openremote/model/attribute/LinkedAttributeDescriptor.java+++ b/model/src/main/java/org/openremote/model/attribute/LinkedAttributeDescriptor.java@@ -31,7 +31,7 @@ public class LinkedAttributeDescriptor {public LinkedAttributeDescriptor(String name,String displayName,- AttributeValueType attributeValueTypeDescriptor,+ AttributeValueDescriptor attributeValueTypeDescriptor,boolean readOnly,boolean executable,MetaItem[] metaItems) {diff --git a/model/src/main/java/org/openremote/model/attribute/MetaItemType.java b/model/src/main/java/org/openremote/model/attribute/MetaItemType.javaindex 4eb68f8e6..f564e6613 100644--- a/model/src/main/java/org/openremote/model/attribute/MetaItemType.java+++ b/model/src/main/java/org/openremote/model/attribute/MetaItemType.java@@ -402,12 +402,12 @@ public enum MetaItemType implements MetaItemDescriptor {false),/**- * Indicates the specific type the this attribute represents.- * For e.g. if the attribute represents currency and it's in euro's then the specific type would be EUR.- * For e.g. if the attribute represents distance and it's in kilometers then the specific type would be KM.+ * Indicates the unit type the this attribute represents.+ * For e.g. if the attribute represents currency and it's in euro's then the unit type would be EUR.+ * For e.g. if the attribute represents distance and it's in kilometers then the unit type would be KM.*/- SPECIFIC_TYPE(- ASSET_META_NAMESPACE + ":specificType",+ UNIT_TYPE(+ ASSET_META_NAMESPACE + ":unitType",new Access(true, false, true),ValueType.STRING,null,diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetModelResourceTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetModelResourceTest.groovyindex 1dc49ebda..790d9cc6c 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetModelResourceTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetModelResourceTest.groovy@@ -115,7 +115,7 @@ class AssetModelResourceTest extends Specification implements ManagerContainerTrdef attributeValueTypeDescriptors = assetModelResource.getAttributeValueDescriptors(null)then: "the default value types should be present"- attributeValueTypeDescriptors.size() == 61+ attributeValueTypeDescriptors.size() == 36when: "a request for Attribute value types is made"diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovyindex 8c60d471a..946e5c697 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy@@ -674,16 +674,17 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTraidef resultAttributes = apartment1Livingroom.getAttributesList()resultAttributes.size() == 7def currentTemperature = apartment1Livingroom.getAttribute("currentTemperature").get()- currentTemperature.getType().get() == AttributeValueType.TEMPERATURE_CELCIUS+ currentTemperature.getType().get() == AttributeValueType.TEMPERATURE!currentTemperature.getValue().isPresent()Meta resultMeta = currentTemperature.getMeta()- resultMeta.size() == 6+ resultMeta.size() == 7resultMeta.stream().filter(isMetaNameEqualTo(LABEL)).findFirst().get().getValueAsString().get() == "Current temperature"resultMeta.stream().filter(isMetaNameEqualTo(READ_ONLY)).findFirst().get().getValueAsBoolean().get()resultMeta.stream().filter(isMetaNameEqualTo(RULE_STATE)).findFirst().get().getValueAsBoolean().get()resultMeta.stream().filter(isMetaNameEqualTo(STORE_DATA_POINTS)).findFirst().get().getValueAsBoolean().get()resultMeta.stream().filter(isMetaNameEqualTo(SHOW_ON_DASHBOARD)).findFirst().get().getValueAsBoolean().get()resultMeta.stream().filter(isMetaNameEqualTo(FORMAT)).findFirst().get().getValueAsString().get() == "%0.1f° C"+ resultMeta.stream().filter(isMetaNameEqualTo(UNIT_TYPE)).findFirst().get().getValueAsString().get() == "CELSIUS"when: "an asset is retrieved by ID in a foreign realm"assetResource.get(null, managerDemoSetup.thingId)diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovyindex 2013a2c36..cddbefe0b 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetQueryTest.groovy@@ -419,9 +419,9 @@ class AssetQueryTest extends Specification implements ManagerContainerTrait {assets.get(1).id == managerDemoSetup.apartment1LivingroomIdassets.get(1).getAttributesList().size() == 7!assets.get(1).getAttribute("currentTemperature").get().getValue().isPresent()- assets.get(1).getAttribute("currentTemperature").get().meta.size() == 6+ assets.get(1).getAttribute("currentTemperature").get().meta.size() == 7!assets.get(1).getAttribute("targetTemperature").get().getValue().isPresent()- assets.get(1).getAttribute("targetTemperature").get().meta.size() == 5+ assets.get(1).getAttribute("targetTemperature").get().meta.size() == 6assets.get(2).id == managerDemoSetup.apartment1KitchenIdassets.get(3).id == managerDemoSetup.apartment1HallwayIdassets.get(4).id == managerDemoSetup.apartment1Bedroom1Iddiff --git a/ui/app/main/src/components/or-asset-summary-card.ts b/ui/app/main/src/components/or-asset-summary-card.tsindex 6d4bd59e9..aca0c306d 100644--- a/ui/app/main/src/components/or-asset-summary-card.ts+++ b/ui/app/main/src/components/or-asset-summary-card.ts@@ -37,7 +37,7 @@ orAttributeTemplateProvider.setTemplate((attribute) => {template = html`<or-translate value="${attribute.value ? "On" : "Off"}"></or-translate>`;break;case AttributeValueType.NUMBER.name:- case AttributeValueType.SOUND_DB.name:+ case AttributeValueType.SOUND.name:template = attribute.value ? new Intl.NumberFormat().format(attribute.value) : "-";break;case AttributeValueType.STRING.name:@@ -253,4 +253,4 @@ export class OrAssetSummaryCard extends subscribe(manager)(LitElement) {return descriptor.color;}}-}\ No newline at end of file+}diff --git a/ui/component/or-attribute-input/src/index.ts b/ui/component/or-attribute-input/src/index.tsindex 3fce466e5..29f7e4d92 100644--- a/ui/component/or-attribute-input/src/index.ts+++ b/ui/component/or-attribute-input/src/index.ts@@ -69,7 +69,7 @@ export function getAttributeValueTemplate(case AttributeValueType.ARRAY.name:inputType = InputType.JSON;break;- case AttributeValueType.BRIGHTNESS_LUX.name:+ case AttributeValueType.BRIGHTNESS.name:inputType = InputType.NUMBER;step = 1;break;