From a352db5c15fc8e539742a64ab6a6468a96ced24b Mon Sep 17 00:00:00 2001 From: rooedw <96492204+rooedw@users.noreply.github.com> Date: Fri, 4 Aug 2023 18:46:13 +0200 Subject: [PATCH] Add new asset type for heat meters --- .../model/asset/impl/HeatMeterAsset.java | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 model/src/main/java/org/openremote/model/asset/impl/HeatMeterAsset.java diff --git a/model/src/main/java/org/openremote/model/asset/impl/HeatMeterAsset.java b/model/src/main/java/org/openremote/model/asset/impl/HeatMeterAsset.java new file mode 100644 index 0000000000..19f384f1e9 --- /dev/null +++ b/model/src/main/java/org/openremote/model/asset/impl/HeatMeterAsset.java @@ -0,0 +1,63 @@ +package org.openremote.model.asset.impl; + +import jakarta.persistence.Entity; +import org.openremote.model.Constants; +import org.openremote.model.asset.Asset; +import org.openremote.model.asset.AssetDescriptor; +import org.openremote.model.attribute.MetaItem; +import org.openremote.model.value.AttributeDescriptor; +import org.openremote.model.value.MetaItemType; +import org.openremote.model.value.ValueFormat; +import org.openremote.model.value.ValueType; + +import static org.openremote.model.Constants.*; + +@Entity +public class HeatMeterAsset extends Asset { + + public static final AttributeDescriptor METER_POINT_ADMINISTRATION_NUMBER = new AttributeDescriptor<>("meterPointAdministrationNumber", ValueType.TEXT, + new MetaItem<>(MetaItemType.LABEL, "Meter Point Administration Number"), + new MetaItem<>(MetaItemType.READ_ONLY)); + + public static final AttributeDescriptor HEAT_METER_READING = new AttributeDescriptor<>("heatMeterReading", ValueType.NUMBER, + new MetaItem<>(MetaItemType.LABEL, "Heat Meter Reading"), + new MetaItem<>(MetaItemType.READ_ONLY), + new MetaItem<>(MetaItemType.UNITS, Constants.units(UNITS_KILO, UNITS_WATT, UNITS_HOUR))) + .withFormat(ValueFormat.NUMBER_3_DP_MAX()); + + public static final AttributeDescriptor FLOW_TEMPERATURE = new AttributeDescriptor<>("flowTemperature", ValueType.NUMBER, + new MetaItem<>(MetaItemType.LABEL, "Flow Temperature"), + new MetaItem<>(MetaItemType.UNITS, Constants.units(UNITS_CELSIUS)), + new MetaItem<>(MetaItemType.READ_ONLY)) + .withFormat(ValueFormat.NUMBER_3_DP_MAX()); + + public static final AttributeDescriptor RETURN_TEMPERATURE = new AttributeDescriptor<>("returnTemperature", ValueType.NUMBER, + new MetaItem<>(MetaItemType.LABEL, "Return Temperature"), + new MetaItem<>(MetaItemType.UNITS, Constants.units(UNITS_CELSIUS)), + new MetaItem<>(MetaItemType.READ_ONLY)) + .withFormat(ValueFormat.NUMBER_3_DP_MAX()); + + public static final AttributeDescriptor POWER = new AttributeDescriptor<>("power", ValueType.NUMBER, + new MetaItem<>(MetaItemType.LABEL, "Power"), + new MetaItem<>(MetaItemType.UNITS, Constants.units(UNITS_WATT)), + new MetaItem<>(MetaItemType.READ_ONLY)) + .withFormat(ValueFormat.NUMBER_3_DP_MAX()); + + public static final AttributeDescriptor VOLUME_FLOW = new AttributeDescriptor<>("volumeFlow", ValueType.NUMBER, + new MetaItem<>(MetaItemType.LABEL, "Volume Flow"), + new MetaItem<>(MetaItemType.UNITS, Constants.units(UNITS_LITRE, UNITS_PER, UNITS_HOUR)), + new MetaItem<>(MetaItemType.READ_ONLY)) + .withFormat(ValueFormat.NUMBER_3_DP_MAX()); + + public static final AssetDescriptor DESCRIPTOR = new AssetDescriptor<>("counter", "8A293D", HeatMeterAsset.class); + + /** + * For use by hydrators (i.e. JPA/Jackson) + */ + protected HeatMeterAsset() { + } + + public HeatMeterAsset(String name) { + super(name); + } +}