Skip to content

armgit / core

Public Imported from GitHub
0

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

Fixed AssetStatePredicate check. Removed STORE_DATA_POINTS from ElectricityAsset

Michael Rademakerfb5e707fa4ba
diff --git a/manager/src/main/java/org/openremote/manager/rules/AssetQueryPredicate.java b/manager/src/main/java/org/openremote/manager/rules/AssetQueryPredicate.java
index 4f3879dba..7f704f6f4 100644
--- a/manager/src/main/java/org/openremote/manager/rules/AssetQueryPredicate.java
+++ b/manager/src/main/java/org/openremote/manager/rules/AssetQueryPredicate.java
@@ -216,15 +216,14 @@ public class AssetQueryPredicate implements Predicate<AssetState<?>> {
innerMetaPredicate.test(assetState)
);
});
+ assetStatePredicates.add(metaPredicate.get());
}
if (p.previousValue != null) {
Predicate<Object> innerOldValuePredicate = p.previousValue.asPredicate(currentMillisProducer);
oldValuePredicate.set(nameValueHolder -> innerOldValuePredicate.test((nameValueHolder).getOldValue()));
+ assetStatePredicates.add(oldValuePredicate.get());
}
-
- assetStatePredicates.add(metaPredicate.get());
- assetStatePredicates.add(oldValuePredicate.get());
});
}
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricityAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricityAsset.java
index 2ce189666..f819e666e 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricityAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityAsset.java
@@ -32,9 +32,8 @@ public abstract class ElectricityAsset<T extends ElectricityAsset<?>> extends As
public static final AttributeDescriptor<Double> POWER = new AttributeDescriptor<>("power", ValueType.NUMBER,
new MetaItem<>(MetaItemType.READ_ONLY)
).withUnits(UNITS_KILO, UNITS_WATT);
- public static final AttributeDescriptor<Double> POWER_SETPOINT = new AttributeDescriptor<>("powerSetpoint", ValueType.NUMBER,
- new MetaItem<>(MetaItemType.STORE_DATA_POINTS, true)
- ).withUnits(UNITS_KILO, UNITS_WATT).withFormat(ValueFormat.NUMBER_1_DP());
+ public static final AttributeDescriptor<Double> POWER_SETPOINT = new AttributeDescriptor<>("powerSetpoint", ValueType.NUMBER)
+ .withUnits(UNITS_KILO, UNITS_WATT).withFormat(ValueFormat.NUMBER_1_DP());
public static final AttributeDescriptor<Double> POWER_IMPORT_MIN = new AttributeDescriptor<>("powerImportMin", ValueType.POSITIVE_NUMBER)
.withUnits(UNITS_KILO, UNITS_WATT);
public static final AttributeDescriptor<Double> POWER_IMPORT_MAX = new AttributeDescriptor<>("powerImportMax", ValueType.POSITIVE_NUMBER)
@@ -46,22 +45,18 @@ public abstract class ElectricityAsset<T extends ElectricityAsset<?>> extends As
public static final AttributeDescriptor<Double> ENERGY_IMPORT_TOTAL = new AttributeDescriptor<>("energyImportTotal", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY),
- new MetaItem<>(MetaItemType.STORE_DATA_POINTS, true)
+ new MetaItem<>(MetaItemType.READ_ONLY)
).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
public static final AttributeDescriptor<Double> ENERGY_EXPORT_TOTAL = new AttributeDescriptor<>("energyExportTotal", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY),
- new MetaItem<>(MetaItemType.STORE_DATA_POINTS, true)
+ new MetaItem<>(MetaItemType.READ_ONLY)
).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
public static final AttributeDescriptor<Double> ENERGY_LEVEL = new AttributeDescriptor<>("energyLevel", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY),
- new MetaItem<>(MetaItemType.STORE_DATA_POINTS, true)
+ new MetaItem<>(MetaItemType.READ_ONLY)
).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
public static final AttributeDescriptor<Double> ENERGY_CAPACITY = new AttributeDescriptor<>("energyCapacity", ValueType.POSITIVE_NUMBER)
.withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE = new AttributeDescriptor<>("energyLevelPercentage", ValueType.POSITIVE_INTEGER,
- new MetaItem<>(MetaItemType.READ_ONLY),
- new MetaItem<>(MetaItemType.STORE_DATA_POINTS, true)
+ new MetaItem<>(MetaItemType.READ_ONLY)
).withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE_MAX = new AttributeDescriptor<>("energyLevelPercentageMax", ValueType.POSITIVE_INTEGER)
.withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
@@ -82,12 +77,10 @@ public abstract class ElectricityAsset<T extends ElectricityAsset<?>> extends As
public static final AttributeDescriptor<Double> CARBON_EXPORT = new AttributeDescriptor<>("carbonExport", ValueType.POSITIVE_NUMBER)
.withUnits(UNITS_KILO, UNITS_GRAM, UNITS_PER, UNITS_KILO, UNITS_WATT, UNITS_HOUR);
public static final AttributeDescriptor<Integer> CARBON_IMPORT_TOTAL = new AttributeDescriptor<>("carbonImportTotal", ValueType.POSITIVE_INTEGER,
- new MetaItem<>(MetaItemType.READ_ONLY, true),
- new MetaItem<>(MetaItemType.STORE_DATA_POINTS, true)
+ new MetaItem<>(MetaItemType.READ_ONLY, true)
).withUnits(UNITS_KILO, UNITS_GRAM);
public static final AttributeDescriptor<Integer> CARBON_EXPORT_TOTAL = new AttributeDescriptor<>("carbonExportTotal", ValueType.POSITIVE_INTEGER,
- new MetaItem<>(MetaItemType.READ_ONLY, true),
- new MetaItem<>(MetaItemType.STORE_DATA_POINTS, true)
+ new MetaItem<>(MetaItemType.READ_ONLY, true)
).withUnits(UNITS_KILO, UNITS_GRAM);
/**