Skip to content

armgit / core

Public Imported from GitHub
0

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

Asset model cleanup of attribute names, unified electricity assets

Rich Turner70df364401a7
diff --git a/agent/src/main/java/org/openremote/agent/protocol/controller/ControllerAgent.java b/agent/src/main/java/org/openremote/agent/protocol/controller/ControllerAgent.java
index 92914e829..649f20415 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/controller/ControllerAgent.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/controller/ControllerAgent.java
@@ -121,9 +121,8 @@ public class ControllerAgent extends Agent<ControllerAgent, ControllerProtocol,
return getAttributes().getValue(CONTROLLER_URI);
}
- @SuppressWarnings("unchecked")
- public <T extends ControllerAgent> T setControllerURI(String uri) {
+ public ControllerAgent setControllerURI(String uri) {
getAttributes().getOrCreate(CONTROLLER_URI).setValue(uri);
- return (T)this;
+ return this;
}
}
diff --git a/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientAgent.java b/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientAgent.java
index f2824c11b..a2ba44203 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientAgent.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientAgent.java
@@ -153,50 +153,45 @@ public class HttpClientAgent extends Agent<HttpClientAgent, HttpClientProtocol,
return getAttributes().getValue(BASE_URI);
}
- @SuppressWarnings("unchecked")
- public <T extends HttpClientAgent> T setBaseURI(String value) {
+ public HttpClientAgent setBaseURI(String value) {
getAttributes().getOrCreate(BASE_URI).setValue(value);
- return (T)this;
+ return this;
}
public Optional<Boolean> getFollowRedirects() {
return getAttributes().getValue(FOLLOW_REDIRECTS);
}
- @SuppressWarnings("unchecked")
- public <T extends HttpClientAgent> T setFollowRedirects(Boolean value) {
+ public HttpClientAgent setFollowRedirects(Boolean value) {
getAttributes().getOrCreate(FOLLOW_REDIRECTS).setValue(value);
- return (T)this;
+ return this;
}
public Optional<ValueType.MultivaluedStringMap> getRequestHeaders() {
return getAttributes().getValue(REQUEST_HEADERS);
}
- @SuppressWarnings("unchecked")
- public <T extends HttpClientAgent> T setRequestHeaders(ValueType.MultivaluedStringMap value) {
+ public HttpClientAgent setRequestHeaders(ValueType.MultivaluedStringMap value) {
getAttributes().getOrCreate(REQUEST_HEADERS).setValue(value);
- return (T)this;
+ return this;
}
public Optional<ValueType.MultivaluedStringMap> getRequestQueryParameters() {
return getAttributes().getValue(REQUEST_QUERY_PARAMETERS);
}
- @SuppressWarnings("unchecked")
- public <T extends HttpClientAgent> T setRequestQueryParameters(ValueType.MultivaluedStringMap value) {
+ public HttpClientAgent setRequestQueryParameters(ValueType.MultivaluedStringMap value) {
getAttributes().getOrCreate(REQUEST_QUERY_PARAMETERS).setValue(value);
- return (T)this;
+ return this;
}
public Optional<Integer> getRequestTimeoutMillis() {
return getAttributes().getValue(REQUEST_TIMEOUT_MILLIS);
}
- @SuppressWarnings("unchecked")
- public <T extends HttpClientAgent> T setRequestTimeoutMillis(Integer value) {
+ public HttpClientAgent setRequestTimeoutMillis(Integer value) {
getAttributes().getOrCreate(REQUEST_TIMEOUT_MILLIS).setValue(value);
- return (T)this;
+ return this;
}
@Override
diff --git a/agent/src/main/java/org/openremote/agent/protocol/knx/KNXAgent.java b/agent/src/main/java/org/openremote/agent/protocol/knx/KNXAgent.java
index 65aaf9438..f49238bdb 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/knx/KNXAgent.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/knx/KNXAgent.java
@@ -110,30 +110,27 @@ public class KNXAgent extends Agent<KNXAgent, KNXProtocol, KNXAgent.KNXAgentLink
return getAttributes().getValue(MESSAGE_SOURCE_ADDRESS);
}
- @SuppressWarnings("unchecked")
- public <T extends KNXAgent> T setMessageSourceAddress(String value) {
+ public KNXAgent setMessageSourceAddress(String value) {
getAttributes().getOrCreate(MESSAGE_SOURCE_ADDRESS).setValue(value);
- return (T)this;
+ return this;
}
public Optional<Boolean> isNATMode() {
return getAttributes().getValue(NAT_MODE);
}
- @SuppressWarnings("unchecked")
- public <T extends KNXAgent> T setNATMode(Boolean value) {
+ public KNXAgent setNATMode(Boolean value) {
getAttributes().getOrCreate(NAT_MODE).setValue(value);
- return (T)this;
+ return this;
}
public Optional<Boolean> isRoutingMode() {
return getAttributes().getValue(ROUTING_MODE);
}
- @SuppressWarnings("unchecked")
- public <T extends KNXAgent> T setRoutingMode(Boolean value) {
+ public KNXAgent setRoutingMode(Boolean value) {
getAttributes().getOrCreate(ROUTING_MODE).setValue(value);
- return (T)this;
+ return this;
}
@Override
diff --git a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketClientAgent.java b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketClientAgent.java
index 3c605d3bd..5485bf475 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketClientAgent.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketClientAgent.java
@@ -49,10 +49,9 @@ public class WebsocketClientAgent extends IoAgent<WebsocketClientAgent, Websocke
return Optional.ofNullable(websocketSubscriptions);
}
- @SuppressWarnings("unchecked")
- public <T extends WebsocketClientAgentLink> T setWebsocketSubscriptions(WebsocketSubscription[] websocketSubscriptions) {
+ public WebsocketClientAgentLink setWebsocketSubscriptions(WebsocketSubscription[] websocketSubscriptions) {
this.websocketSubscriptions = websocketSubscriptions;
- return (T)this;
+ return this;
}
}
@@ -92,30 +91,27 @@ public class WebsocketClientAgent extends IoAgent<WebsocketClientAgent, Websocke
return getAttributes().getValue(CONNECT_URI);
}
- @SuppressWarnings("unchecked")
- public <T extends WebsocketClientAgent> T setConnectUri(String value) {
+ public WebsocketClientAgent setConnectUri(String value) {
getAttributes().getOrCreate(CONNECT_URI).setValue(value);
- return (T)this;
+ return this;
}
public Optional<ValueType.MultivaluedStringMap> getConnectHeaders() {
return getAttributes().getValue(CONNECT_HEADERS);
}
- @SuppressWarnings("unchecked")
- public <T extends WebsocketClientAgent> T setConnectHeaders(ValueType.MultivaluedStringMap value) {
+ public WebsocketClientAgent setConnectHeaders(ValueType.MultivaluedStringMap value) {
getAttributes().getOrCreate(CONNECT_HEADERS).setValue(value);
- return (T)this;
+ return this;
}
public Optional<WebsocketSubscription[]> getConnectSubscriptions() {
return getAttributes().getValue(CONNECT_SUBSCRIPTIONS);
}
- @SuppressWarnings("unchecked")
- public <T extends WebsocketClientAgent> T setConnectSubscriptions(WebsocketSubscription[] value) {
+ public WebsocketClientAgent setConnectSubscriptions(WebsocketSubscription[] value) {
getAttributes().getOrCreate(CONNECT_SUBSCRIPTIONS).setValue(value);
- return (T)this;
+ return this;
}
@Override
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.java
index b2d7d6b90..bc15934aa 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
@@ -144,7 +144,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
storage1Asset = assetStorageService.merge(storage1Asset);
ElectricityConsumerAsset consumption1Asset = createDemoElectricityConsumerAsset("Consumption De Rotterdam", building1Asset, new GeoJSONPoint(4.487519, 51.906544));
- consumption1Asset.getAttribute(ElectricityConsumerAsset.POWER_TOTAL).ifPresent(assetAttribute -> {
+ consumption1Asset.getAttribute(ElectricityConsumerAsset.POWER).ifPresent(assetAttribute -> {
assetAttribute.addMeta(
new MetaItem<>(
AGENT_LINK,
@@ -185,7 +185,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
ElectricityProducerSolarAsset production1Asset = createDemoElectricitySolarProducerAsset("Solar De Rotterdam", building1Asset, new GeoJSONPoint(4.488592, 51.907047));
production1Asset.setManufacturer("AEG");
production1Asset.setModel("AS-P60");
- production1Asset.getAttribute(ElectricityProducerAsset.POWER_TOTAL).ifPresent(assetAttribute -> {
+ production1Asset.getAttribute(ElectricityProducerAsset.POWER).ifPresent(assetAttribute -> {
assetAttribute.addMeta(
new MetaItem<>(
AGENT_LINK,
@@ -220,9 +220,9 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
)
);
});
- production1Asset.setEnergyTotal(152689d);
- production1Asset.setPowerCapacity(89.6);
- production1Asset.setEfficiency(93);
+ production1Asset.setEnergyExportTotal(152689d);
+ production1Asset.setPowerExportMax(89.6);
+ production1Asset.setEfficiencyExport(93);
production1Asset.setPanelOrientation(ElectricityProducerSolarAsset.PanelOrientation.EAST_WEST);
production1Asset.setId(UniqueIdentifierGenerator.generateId(production1Asset.getName()));
production1Asset = assetStorageService.merge(production1Asset);
@@ -248,7 +248,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
storage2Asset = assetStorageService.merge(storage2Asset);
ElectricityConsumerAsset consumption2Asset = createDemoElectricityConsumerAsset("Consumption Stadhuis", building2Asset, new GeoJSONPoint(4.47933, 51.92259));
- consumption2Asset.getAttribute(ElectricityConsumerAsset.POWER_TOTAL).ifPresent(assetAttribute -> {
+ consumption2Asset.getAttribute(ElectricityConsumerAsset.POWER).ifPresent(assetAttribute -> {
assetAttribute.addMeta(
new MetaItem<>(
AGENT_LINK,
@@ -287,7 +287,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
consumption2Asset = assetStorageService.merge(consumption2Asset);
ElectricityProducerSolarAsset production2Asset = createDemoElectricitySolarProducerAsset("Solar Stadhuis", building2Asset, new GeoJSONPoint(4.47945, 51.92301));
- production2Asset.getAttribute(ElectricityProducerAsset.POWER_TOTAL).ifPresent(assetAttribute -> {
+ production2Asset.getAttribute(ElectricityProducerAsset.POWER).ifPresent(assetAttribute -> {
assetAttribute.addMeta(
new MetaItem<>(
AGENT_LINK,
@@ -322,9 +322,9 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
)
);
});
- production2Asset.setEnergyTotal(88961d);
- production2Asset.setPowerCapacity(19.2);
- production2Asset.setEfficiency(79);
+ production2Asset.setEnergyExportTotal(88961d);
+ production2Asset.setPowerExportMax(19.2);
+ production2Asset.setEfficiencyExport(79);
production2Asset.setPanelOrientation(ElectricityProducerSolarAsset.PanelOrientation.SOUTH);
production2Asset.setManufacturer("Solarwatt");
production2Asset.setModel("EasyIn 60M");
@@ -350,7 +350,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
building3Asset = assetStorageService.merge(building3Asset);
ElectricityProducerSolarAsset production3Asset = createDemoElectricitySolarProducerAsset("Solar Markthal", building3Asset, new GeoJSONPoint(4.47945, 51.92301));
- production3Asset.getAttribute(ElectricityProducerAsset.POWER_TOTAL).ifPresent(assetAttribute -> {
+ production3Asset.getAttribute(ElectricityProducerAsset.POWER).ifPresent(assetAttribute -> {
assetAttribute.addMeta(
new MetaItem<>(
AGENT_LINK,
@@ -385,9 +385,9 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
)
);
});
- production3Asset.setEnergyTotal(24134d);
- production3Asset.setPowerCapacity(29.8);
- production3Asset.setEfficiency(91);
+ production3Asset.setEnergyExportTotal(24134d);
+ production3Asset.setPowerExportMax(29.8);
+ production3Asset.setEfficiencyExport(91);
production3Asset.setPanelOrientation(ElectricityProducerSolarAsset.PanelOrientation.SOUTH);
production3Asset.setManufacturer("Sunpower");
production3Asset.setModel("E20-327");
@@ -396,7 +396,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
ElectricityChargerAsset charger1Asset = createDemoElectricityChargerAsset("Charger 1 Markthal", building3Asset, new GeoJSONPoint(4.486143, 51.920058));
charger1Asset.setPower(0d);
- charger1Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER_TOTAL).addMeta(
+ charger1Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER).addMeta(
new MetaItem<>(
AGENT_LINK,
new SimulatorAgent.SimulatorAgentLink(smartcitySimulatorAgentId).setSimulatorReplayData(
@@ -436,7 +436,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
ElectricityChargerAsset charger2Asset = createDemoElectricityChargerAsset("Charger 2 Markthal", building3Asset, new GeoJSONPoint(4.486188, 51.919957));
charger2Asset.setPower(0d);
- charger2Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER_TOTAL)
+ charger2Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER)
.addMeta(
new MetaItem<>(
AGENT_LINK,
@@ -477,7 +477,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
ElectricityChargerAsset charger3Asset = createDemoElectricityChargerAsset("Charger 3 Markthal", building3Asset, new GeoJSONPoint(4.486232, 51.919856));
charger3Asset.setPower(0d);
- charger3Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER_TOTAL)
+ charger3Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER)
.addMeta(
new MetaItem<>(
AGENT_LINK,
@@ -518,7 +518,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
ElectricityChargerAsset charger4Asset = createDemoElectricityChargerAsset("Charger 4 Markthal", building3Asset, new GeoJSONPoint(4.486286, 51.919733));
charger4Asset.setPower(0d);
- charger4Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER_TOTAL)
+ charger4Asset.getAttributes().getOrCreate(ElectricityChargerAsset.POWER)
.addMeta(
new MetaItem<>(
AGENT_LINK,
@@ -573,7 +573,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
building4Asset = assetStorageService.merge(building4Asset);
ElectricityConsumerAsset consumption4Asset = createDemoElectricityConsumerAsset("Consumption Erasmianum", building4Asset, new GeoJSONPoint(4.468324, 51.912062));
- consumption4Asset.getAttribute(ElectricityConsumerAsset.POWER_TOTAL).ifPresent(assetAttribute -> {
+ consumption4Asset.getAttribute(ElectricityConsumerAsset.POWER).ifPresent(assetAttribute -> {
assetAttribute.addMeta(
new MetaItem<>(
AGENT_LINK,
@@ -626,7 +626,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
building5Asset = assetStorageService.merge(building5Asset);
ElectricityConsumerAsset consumption5Asset = createDemoElectricityConsumerAsset("Consumption Zwembad", building5Asset, new GeoJSONPoint(4.498048, 51.925770));
- consumption5Asset.getAttribute(ElectricityConsumerAsset.POWER_TOTAL).ifPresent(assetAttribute -> {
+ consumption5Asset.getAttribute(ElectricityConsumerAsset.POWER).ifPresent(assetAttribute -> {
assetAttribute.addMeta(
new MetaItem<>(
AGENT_LINK,
@@ -665,7 +665,7 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
consumption5Asset = assetStorageService.merge(consumption5Asset);
ElectricityProducerSolarAsset production5Asset = createDemoElectricitySolarProducerAsset("Solar Zwembad", building5Asset, new GeoJSONPoint(4.498281, 51.925507));
- production5Asset.getAttribute(ElectricityProducerAsset.POWER_TOTAL).ifPresent(assetAttribute -> {
+ production5Asset.getAttribute(ElectricityProducerAsset.POWER).ifPresent(assetAttribute -> {
assetAttribute.addMeta(
new MetaItem<>(
AGENT_LINK,
@@ -700,9 +700,9 @@ public class ManagerDemoSetup extends AbstractManagerSetup {
)
);
});
- production5Asset.setEnergyTotal(23461d);
- production5Asset.setPowerCapacity(76.2);
- production5Asset.setEfficiency(86);
+ production5Asset.setEnergyExportTotal(23461d);
+ production5Asset.setPowerExportMax(76.2);
+ production5Asset.setEfficiencyExport(86);
production5Asset.setPanelOrientation(ElectricityProducerSolarAsset.PanelOrientation.SOUTH);
production5Asset.setManufacturer("S-Energy");
production5Asset.setModel("SN260P-10");
diff --git a/model/src/main/java/org/openremote/model/EntityClassProvider.java b/model/src/main/java/org/openremote/model/EntityClassProvider.java
index 72ea7436d..ac54c3ba4 100644
--- a/model/src/main/java/org/openremote/model/EntityClassProvider.java
+++ b/model/src/main/java/org/openremote/model/EntityClassProvider.java
@@ -24,7 +24,7 @@ import org.openremote.model.util.TsIgnore;
import java.util.List;
/**
- * Interface for providing a list of entity class names to be registered for JPA, this can be used for registering custom
+ * Interface for providing a list of entity class names to be registered for JPA, this can be used for registering
* custom {@link org.openremote.model.asset.Asset} types etc. Instances should be registered using the standard
* {@link java.util.ServiceLoader} mechanism.
*/
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricVehicleAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricVehicleAsset.java
index f38d829a4..a68f6fe96 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricVehicleAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricVehicleAsset.java
@@ -37,8 +37,6 @@ import static org.openremote.model.Constants.*;
public class ElectricVehicleAsset extends ElectricityStorageAsset {
public static final AttributeDescriptor<ElectricityChargerAsset.ConnectorType> CONNECTOR_TYPE = new AttributeDescriptor<>("connectorType", ElectricityChargerAsset.CONNECTOR_TYPE_VALUE);
- public static final AttributeDescriptor<Double> EFFICIENCY = new AttributeDescriptor<>("efficiency", ValueType.POSITIVE_NUMBER)
- .withUnits(UNITS_KILO, UNITS_METRE, UNITS_PER, UNITS_KILO, UNITS_WATT, UNITS_HOUR);
public static final AttributeDescriptor<Integer> ODOMETER = new AttributeDescriptor<>("odometer", ValueType.POSITIVE_INTEGER)
.withUnits(UNITS_KILO, UNITS_METRE);
public static final AttributeDescriptor<Boolean> CHARGER_CONNECTED = new AttributeDescriptor<>("chargerConnected", ValueType.BOOLEAN);
@@ -56,6 +54,154 @@ public class ElectricVehicleAsset extends ElectricityStorageAsset {
super(name);
}
+ public Optional<ElectricityChargerAsset.ConnectorType> getConnectorType() {
+ return getAttributes().getValue(CONNECTOR_TYPE);
+ }
+
+ public ElectricVehicleAsset setConnectorType(ElectricityChargerAsset.ConnectorType value) {
+ getAttributes().getOrCreate(CONNECTOR_TYPE).setValue(value);
+ return this;
+ }
+
+ public Optional<Integer> getOdometer() {
+ return getAttributes().getValue(ODOMETER);
+ }
+
+ public ElectricVehicleAsset setOdometer(Integer value) {
+ getAttributes().getOrCreate(ODOMETER).setValue(value);
+ return this;
+ }
+
+ public Optional<Boolean> getChargerConnected() {
+ return getAttributes().getValue(CHARGER_CONNECTED);
+ }
+
+ public ElectricVehicleAsset setChargerConnected(Boolean value) {
+ getAttributes().getOrCreate(CHARGER_CONNECTED).setValue(value);
+ return this;
+ }
+
+
+ @Override
+ public ElectricVehicleAsset setPower(Double value) {
+ super.setPower(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setPowerSetpoint(Double value) {
+ super.setPowerSetpoint(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setPowerImportMin(Double value) {
+ super.setPowerImportMin(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setPowerImportMax(Double value) {
+ super.setPowerImportMax(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setPowerExportMin(Double value) {
+ super.setPowerExportMin(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setPowerExportMax(Double value) {
+ super.setPowerExportMax(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setEnergyImportTotal(Double value) {
+ super.setEnergyImportTotal(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setEnergyExportTotal(Double value) {
+ super.setEnergyExportTotal(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setEnergyCapacity(Double value) {
+ super.setEnergyCapacity(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setEnergyLevel(Double value) {
+ super.setEnergyLevel(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setEnergyLevelPercentage(Integer value) {
+ super.setEnergyLevelPercentage(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setEnergyLevelPercentageMin(Integer value) {
+ super.setEnergyLevelPercentageMin(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setEnergyLevelPercentageMax(Integer value) {
+ super.setEnergyLevelPercentageMax(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setEfficiencyImport(Integer value) {
+ super.setEfficiencyImport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setEfficiencyExport(Integer value) {
+ super.setEfficiencyExport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setTariffImport(Double value) {
+ super.setTariffImport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setTariffExport(Double value) {
+ super.setTariffExport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setCarbonImport(Double value) {
+ super.setCarbonImport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setCarbonExport(Double value) {
+ super.setCarbonExport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricVehicleAsset setCarbonTotal(Integer value) {
+ super.setCarbonTotal(value);
+ return this;
+ }
+
@Override
public ElectricVehicleAsset setId(String id) {
super.setId(id);
@@ -163,40 +309,4 @@ public class ElectricVehicleAsset extends ElectricityStorageAsset {
super.setTags(tags);
return this;
}
-
- public Optional<ElectricityChargerAsset.ConnectorType> getConnectorType() {
- return getAttributes().getValue(CONNECTOR_TYPE);
- }
-
- public ElectricVehicleAsset setConnectorType(ElectricityChargerAsset.ConnectorType value) {
- getAttributes().getOrCreate(CONNECTOR_TYPE).setValue(value);
- return this;
- }
-
- public Optional<Double> getEfficiency() {
- return getAttributes().getValue(EFFICIENCY);
- }
-
- public ElectricVehicleAsset setEfficiency(Double value) {
- getAttributes().getOrCreate(EFFICIENCY).setValue(value);
- return this;
- }
-
- public Optional<Integer> getOdometer() {
- return getAttributes().getValue(ODOMETER);
- }
-
- public ElectricVehicleAsset setOdometer(Integer value) {
- getAttributes().getOrCreate(ODOMETER).setValue(value);
- return this;
- }
-
- public Optional<Boolean> getChargerConnected() {
- return getAttributes().getValue(CHARGER_CONNECTED);
- }
-
- public ElectricVehicleAsset setChargerConnected(Boolean value) {
- getAttributes().getOrCreate(CHARGER_CONNECTED).setValue(value);
- return this;
- }
}
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
new file mode 100644
index 000000000..8f9495dd6
--- /dev/null
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityAsset.java
@@ -0,0 +1,277 @@
+/*
+ * Copyright 2020, OpenRemote Inc.
+ *
+ * See the CONTRIBUTORS.txt file in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.openremote.model.asset.impl;
+
+import org.openremote.model.asset.Asset;
+import org.openremote.model.asset.AssetDescriptor;
+import org.openremote.model.attribute.MetaItem;
+import org.openremote.model.value.*;
+
+import java.util.Optional;
+
+import static org.openremote.model.Constants.*;
+
+@SuppressWarnings("unchecked")
+public abstract class ElectricityAsset<T extends ElectricityAsset<?>> extends Asset<T> {
+
+ public static final AttributeDescriptor<Double> POWER = new AttributeDescriptor<>("power", ValueType.POSITIVE_NUMBER,
+ new MetaItem<>(MetaItemType.READ_ONLY)
+ ).withUnits(UNITS_KILO, UNITS_WATT);
+ public static final AttributeDescriptor<Double> POWER_SETPOINT = new AttributeDescriptor<>("powerSetpoint", ValueType.POSITIVE_NUMBER,
+ new MetaItem<>(MetaItemType.READ_ONLY)
+ ).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)
+ .withUnits(UNITS_KILO, UNITS_WATT);
+ public static final AttributeDescriptor<Double> POWER_EXPORT_MIN = new AttributeDescriptor<>("powerExportMin", ValueType.POSITIVE_NUMBER)
+ .withUnits(UNITS_KILO, UNITS_WATT);
+ public static final AttributeDescriptor<Double> POWER_EXPORT_MAX = new AttributeDescriptor<>("powerExportMax", ValueType.POSITIVE_NUMBER,
+ new MetaItem<>(MetaItemType.READ_ONLY)
+ ).withUnits(UNITS_KILO, UNITS_WATT);
+
+
+ public static final AttributeDescriptor<Double> ENERGY_IMPORT_TOTAL = new AttributeDescriptor<>("energyImportTotal", ValueType.POSITIVE_NUMBER,
+ 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)
+ ).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)
+ ).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
+ public static final AttributeDescriptor<Double> ENERGY_CAPACITY = new AttributeDescriptor<>("energyCapacity", ValueType.POSITIVE_NUMBER,
+ new MetaItem<>(MetaItemType.READ_ONLY)
+ ).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
+ public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE = new AttributeDescriptor<>("energyLevelPercentage", ValueType.POSITIVE_INTEGER)
+ .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));
+ public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE_MIN = new AttributeDescriptor<>("energyLevelPercentageMin", ValueType.POSITIVE_INTEGER)
+ .withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
+ public static final AttributeDescriptor<Integer> EFFICIENCY_IMPORT = new AttributeDescriptor<>("efficiencyImport", ValueType.POSITIVE_INTEGER)
+ .withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
+ public static final AttributeDescriptor<Integer> EFFICIENCY_EXPORT = new AttributeDescriptor<>("efficiencyExport", ValueType.POSITIVE_INTEGER)
+ .withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
+
+
+ public static final AttributeDescriptor<Double> TARIFF_IMPORT = new AttributeDescriptor<>("tariffImport", ValueType.POSITIVE_NUMBER)
+ .withUnits("EUR", UNITS_PER, UNITS_KILO, UNITS_WATT, UNITS_HOUR);
+ public static final AttributeDescriptor<Double> TARIFF_EXPORT = new AttributeDescriptor<>("tariffExport", ValueType.POSITIVE_NUMBER)
+ .withUnits("EUR", UNITS_PER, UNITS_KILO, UNITS_WATT, UNITS_HOUR);
+ public static final AttributeDescriptor<Double> CARBON_IMPORT = new AttributeDescriptor<>("carbonImport", ValueType.POSITIVE_NUMBER)
+ .withUnits(UNITS_KILO, UNITS_GRAM, UNITS_PER, UNITS_KILO, UNITS_WATT, UNITS_HOUR);
+ 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_TOTAL = new AttributeDescriptor<>("carbonTotal", ValueType.POSITIVE_INTEGER,
+ new MetaItem<>(MetaItemType.READ_ONLY, true)
+ ).withUnits(UNITS_KILO, UNITS_GRAM);
+
+ /**
+ * For use by hydrators (i.e. JPA/Jackson)
+ */
+ ElectricityAsset() {
+ this(null);
+ }
+
+ public ElectricityAsset(String name) {
+ super(name);
+ }
+
+ public Optional<Double> getPower() {
+ return getAttributes().getValue(POWER);
+ }
+
+ public T setPower(Double value) {
+ getAttributes().getOrCreate(POWER).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Double> getPowerSetpoint() {
+ return getAttributes().getValue(POWER_SETPOINT);
+ }
+
+ public T setPowerSetpoint(Double value) {
+ getAttributes().getOrCreate(POWER_SETPOINT).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Double> getPowerImportMin() {
+ return getAttributes().getValue(POWER_IMPORT_MIN);
+ }
+
+ public T setPowerImportMin(Double value) {
+ getAttributes().getOrCreate(POWER_IMPORT_MIN).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Double> getPowerImportMax() {
+ return getAttributes().getValue(POWER_IMPORT_MAX);
+ }
+
+ public T setPowerImportMax(Double value) {
+ getAttributes().getOrCreate(POWER_IMPORT_MAX).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Double> getPowerExportMin() {
+ return getAttributes().getValue(POWER_EXPORT_MIN);
+ }
+
+ public T setPowerExportMin(Double value) {
+ getAttributes().getOrCreate(POWER_EXPORT_MIN).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Double> getPowerExportMax() {
+ return getAttributes().getValue(POWER_EXPORT_MAX);
+ }
+
+ public T setPowerExportMax(Double value) {
+ getAttributes().getOrCreate(POWER_EXPORT_MAX).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Double> getEnergyImportTotal() {
+ return getAttributes().getValue(ENERGY_IMPORT_TOTAL);
+ }
+
+ public T setEnergyImportTotal(Double value) {
+ getAttributes().getOrCreate(ENERGY_IMPORT_TOTAL).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Double> getEnergyExportTotal() {
+ return getAttributes().getValue(ENERGY_EXPORT_TOTAL);
+ }
+
+ public T setEnergyExportTotal(Double value) {
+ getAttributes().getOrCreate(ENERGY_EXPORT_TOTAL).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Double> getEnergyCapacity() {
+ return getAttributes().getValue(ENERGY_CAPACITY);
+ }
+
+ public T setEnergyCapacity(Double value) {
+ getAttributes().getOrCreate(ENERGY_CAPACITY).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Double> getEnergyLevel() {
+ return getAttributes().getValue(ENERGY_LEVEL);
+ }
+
+ public T setEnergyLevel(Double value) {
+ getAttributes().getOrCreate(ENERGY_LEVEL).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Integer> getEnergyLevelPercentage() {
+ return getAttributes().getValue(ENERGY_LEVEL_PERCENTAGE);
+ }
+
+ public T setEnergyLevelPercentage(Integer value) {
+ getAttributes().getOrCreate(ENERGY_LEVEL_PERCENTAGE).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Integer> getEnergyLevelPercentageMin() {
+ return getAttributes().getValue(ENERGY_LEVEL_PERCENTAGE_MIN);
+ }
+
+ public T setEnergyLevelPercentageMin(Integer value) {
+ getAttributes().getOrCreate(ENERGY_LEVEL_PERCENTAGE_MIN).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Integer> getEnergyLevelPercentageMax() {
+ return getAttributes().getValue(ENERGY_LEVEL_PERCENTAGE_MAX);
+ }
+
+ public T setEnergyLevelPercentageMax(Integer value) {
+ getAttributes().getOrCreate(ENERGY_LEVEL_PERCENTAGE_MAX).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Integer> getEfficiencyImport() {
+ return getAttributes().getValue(EFFICIENCY_IMPORT);
+ }
+
+ public T setEfficiencyImport(Integer value) {
+ getAttributes().getOrCreate(EFFICIENCY_IMPORT).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Integer> getEfficiencyExport() {
+ return getAttributes().getValue(EFFICIENCY_EXPORT);
+ }
+
+ public T setEfficiencyExport(Integer value) {
+ getAttributes().getOrCreate(EFFICIENCY_EXPORT).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Double> getTariffImport() {
+ return getAttributes().getValue(TARIFF_IMPORT);
+ }
+
+ public T setTariffImport(Double value) {
+ getAttributes().getOrCreate(TARIFF_IMPORT).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Double> getTariffExport() {
+ return getAttributes().getValue(TARIFF_EXPORT);
+ }
+
+ public T setTariffExport(Double value) {
+ getAttributes().getOrCreate(TARIFF_EXPORT).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Double> getCarbonImport() {
+ return getAttributes().getValue(CARBON_IMPORT);
+ }
+
+ public T setCarbonImport(Double value) {
+ getAttributes().getOrCreate(CARBON_IMPORT).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Double> getCarbonExport() {
+ return getAttributes().getValue(CARBON_EXPORT);
+ }
+
+ public T setCarbonExport(Double value) {
+ getAttributes().getOrCreate(CARBON_EXPORT).setValue(value);
+ return (T)this;
+ }
+
+ public Optional<Integer> getCarbonTotal() {
+ return getAttributes().getValue(CARBON_TOTAL);
+ }
+
+ public T setCarbonTotal(Integer value) {
+ getAttributes().getOrCreate(CARBON_TOTAL).setValue(value);
+ return (T)this;
+ }
+}
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricityChargerAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricityChargerAsset.java
index 9bcb8dca4..e86673ec0 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricityChargerAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityChargerAsset.java
@@ -19,19 +19,16 @@
*/
package org.openremote.model.asset.impl;
-import org.openremote.model.asset.Asset;
import org.openremote.model.asset.AssetDescriptor;
-import org.openremote.model.attribute.MetaItem;
-import org.openremote.model.value.*;
+import org.openremote.model.value.AttributeDescriptor;
+import org.openremote.model.value.ValueDescriptor;
import javax.persistence.Entity;
import java.util.Optional;
-import static org.openremote.model.Constants.*;
-
@SuppressWarnings("unchecked")
@Entity
-public class ElectricityChargerAsset extends Asset<ElectricityChargerAsset> {
+public class ElectricityChargerAsset extends ElectricityAsset<ElectricityChargerAsset> {
public enum ConnectorType {
YAZAKI,
@@ -42,23 +39,9 @@ public class ElectricityChargerAsset extends Asset<ElectricityChargerAsset> {
SCHUKO
}
- public static final ValueDescriptor<ConnectorType> CONNECTOR_TYPE_VALUE = new ValueDescriptor<>("chargerType", ConnectorType.class);
+ public static final ValueDescriptor<ConnectorType> CONNECTOR_TYPE_VALUE = new ValueDescriptor<>("connectorType", ConnectorType.class);
- public static final AttributeDescriptor<String> STATUS = new AttributeDescriptor<>("status", ValueType.TEXT,
- new MetaItem<>(MetaItemType.READ_ONLY)
- );
public static final AttributeDescriptor<ConnectorType> CONNECTOR_TYPE = new AttributeDescriptor<>("connectorType", CONNECTOR_TYPE_VALUE);
- public static final AttributeDescriptor<Double> POWER_CAPACITY_IMPORT = new AttributeDescriptor<>("powerCapacityImport", ValueType.POSITIVE_NUMBER)
- .withUnits(UNITS_KILO, UNITS_WATT).withFormat(ValueFormat.NUMBER_0_DP());
- public static final AttributeDescriptor<Double> POWER_CAPACITY_EXPORT = new AttributeDescriptor<>("powerCapacityExport", ValueType.POSITIVE_NUMBER)
- .withUnits(UNITS_KILO, UNITS_WATT).withFormat(ValueFormat.NUMBER_0_DP());
- public static final AttributeDescriptor<Double> POWER_TOTAL = new AttributeDescriptor<>("power", ValueType.NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_KILO, UNITS_WATT).withFormat(ValueFormat.NUMBER_1_DP());
- public static final AttributeDescriptor<Double> POWER_SETPOINT = new AttributeDescriptor<>("powerSetpoint", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_KILO, UNITS_WATT).withFormat(ValueFormat.NUMBER_1_DP());
-
public static final AssetDescriptor<ElectricityChargerAsset> DESCRIPTOR = new AssetDescriptor<>("ev-station", "8A293D", ElectricityChargerAsset.class);
@@ -73,60 +56,13 @@ public class ElectricityChargerAsset extends Asset<ElectricityChargerAsset> {
super(name);
}
- public Optional<String> getStatus() {
- return getAttributes().getValue(STATUS);
- }
-
-
- public <T extends ElectricityChargerAsset> T setStatus(String value) {
- getAttributes().getOrCreate(STATUS).setValue(value);
- return (T)this;
- }
-
public Optional<ConnectorType> getConnectorType() {
return getAttributes().getValue(CONNECTOR_TYPE);
}
- public <T extends ElectricityChargerAsset> T setConnectorType(ConnectorType value) {
+ public ElectricityChargerAsset setConnectorType(ConnectorType value) {
getAttributes().getOrCreate(CONNECTOR_TYPE).setValue(value);
- return (T)this;
- }
-
- public Optional<Double> getPowerCapacityImport() {
- return getAttributes().getValue(POWER_CAPACITY_IMPORT);
- }
-
-
- public <T extends ElectricityChargerAsset> T setPowerCapacityImport(Double value) {
- getAttributes().getOrCreate(POWER_CAPACITY_IMPORT).setValue(value);
- return (T)this;
- }
-
- public Optional<Double> getPowerCapacityExport() {
- return getAttributes().getValue(POWER_CAPACITY_EXPORT);
- }
-
- public <T extends ElectricityChargerAsset> T setPowerCapacityExport(Double value) {
- getAttributes().getOrCreate(POWER_CAPACITY_EXPORT).setValue(value);
- return (T)this;
- }
-
- public Optional<Double> getPower() {
- return getAttributes().getValue(POWER_TOTAL);
- }
-
- public <T extends ElectricityChargerAsset> T setPower(Double value) {
- getAttributes().getOrCreate(POWER_TOTAL).setValue(value);
- return (T)this;
- }
-
- public Optional<Double> getPowerSetpoint() {
- return getAttributes().getValue(POWER_SETPOINT);
- }
-
- public <T extends ElectricityChargerAsset> T setPowerSetpoint(Double value) {
- getAttributes().getOrCreate(POWER_SETPOINT).setValue(value);
- return (T)this;
+ return this;
}
}
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricityConsumerAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricityConsumerAsset.java
index a5408ffe6..dfd0e229e 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricityConsumerAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityConsumerAsset.java
@@ -19,38 +19,12 @@
*/
package org.openremote.model.asset.impl;
-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.ValueDescriptor;
-import org.openremote.model.value.ValueType;
import javax.persistence.Entity;
-import java.util.Optional;
-import static org.openremote.model.Constants.*;
-
-@SuppressWarnings("unchecked")
@Entity
-public class ElectricityConsumerAsset extends Asset<ElectricityConsumerAsset> {
-
- public static final AttributeDescriptor<String> STATUS = new AttributeDescriptor<>("status", ValueType.TEXT,
- new MetaItem<>(MetaItemType.READ_ONLY)
- );
- public static final AttributeDescriptor<Double> POWER_TOTAL = new AttributeDescriptor<>("power", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_KILO, UNITS_WATT);
- public static final AttributeDescriptor<Double> POWER_AVAILABLE_MAX = new AttributeDescriptor<>("powerAvailableMax", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_KILO, UNITS_WATT);
- public static final AttributeDescriptor<Double> POWER_AVAILABLE_MIN = new AttributeDescriptor<>("powerAvailableMin", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_KILO, UNITS_WATT);
- public static final AttributeDescriptor<Double> ENERGY_TOTAL = new AttributeDescriptor<>("energyTotal", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
+public class ElectricityConsumerAsset extends ElectricityAsset<ElectricityConsumerAsset> {
public static final AssetDescriptor<ElectricityConsumerAsset> DESCRIPTOR = new AssetDescriptor<>("power-plug", "8A293D", ElectricityConsumerAsset.class);
@@ -64,49 +38,4 @@ public class ElectricityConsumerAsset extends Asset<ElectricityConsumerAsset> {
public ElectricityConsumerAsset(String name) {
super(name);
}
-
- public Optional<String> getStatus() {
- return getAttributes().getValue(STATUS);
- }
-
- public <T extends ElectricityConsumerAsset> T setStatus(String value) {
- getAttributes().getOrCreate(STATUS).setValue(value);
- return (T)this;
- }
-
- public Optional<Double> getPower() {
- return getAttributes().getValue(POWER_TOTAL);
- }
-
- public <T extends ElectricityConsumerAsset> T setPower(Double value) {
- getAttributes().getOrCreate(POWER_TOTAL).setValue(value);
- return (T)this;
- }
-
- public Optional<Double> getPowerAvailableMax() {
- return getAttributes().getValue(POWER_AVAILABLE_MAX);
- }
-
- public <T extends ElectricityConsumerAsset> T setPowerAvailableMax(Double value) {
- getAttributes().getOrCreate(POWER_AVAILABLE_MAX).setValue(value);
- return (T)this;
- }
-
- public Optional<Double> getPowerAvailableMin() {
- return getAttributes().getValue(POWER_AVAILABLE_MIN);
- }
-
- public <T extends ElectricityConsumerAsset> T setPowerAvailableMin(Double value) {
- getAttributes().getOrCreate(POWER_AVAILABLE_MIN).setValue(value);
- return (T)this;
- }
-
- public Optional<Double> getEnergyTotal() {
- return getAttributes().getValue(ENERGY_TOTAL);
- }
-
- public <T extends ElectricityConsumerAsset> T setEnergyTotal(Double value) {
- getAttributes().getOrCreate(ENERGY_TOTAL).setValue(value);
- return (T)this;
- }
}
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerAsset.java
index 6396bd33c..2d0979fe7 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerAsset.java
@@ -19,35 +19,12 @@
*/
package org.openremote.model.asset.impl;
-import org.openremote.model.asset.Asset;
import org.openremote.model.asset.AssetDescriptor;
-import org.openremote.model.attribute.MetaItem;
-import org.openremote.model.value.*;
import javax.persistence.Entity;
-import java.util.Optional;
-
-import static org.openremote.model.Constants.*;
@Entity
-public class ElectricityProducerAsset extends Asset<ElectricityProducerAsset> {
-
- public static final AttributeDescriptor<String> STATUS = new AttributeDescriptor<>("status", ValueType.TEXT,
- new MetaItem<>(MetaItemType.READ_ONLY)
- );
- public static final AttributeDescriptor<Double> POWER_CAPACITY = new AttributeDescriptor<>("powerCapacity", ValueType.POSITIVE_NUMBER)
- .withUnits(UNITS_KILO, UNITS_WATT);
- public static final AttributeDescriptor<Integer> EFFICIENCY = new AttributeDescriptor<>("efficiency", ValueType.POSITIVE_INTEGER)
- .withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
- public static final AttributeDescriptor<Double> POWER_TOTAL = new AttributeDescriptor<>("power", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_KILO, UNITS_WATT);
- public static final AttributeDescriptor<Double> POWER_FORECAST_DEVIATION = new AttributeDescriptor<>("powerForecastDeviation", ValueType.NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_KILO, UNITS_WATT);
- public static final AttributeDescriptor<Double> ENERGY_TOTAL = new AttributeDescriptor<>("energyTotal", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
+public class ElectricityProducerAsset extends ElectricityAsset<ElectricityProducerAsset> {
public static final AssetDescriptor<ElectricityProducerAsset> DESCRIPTOR = new AssetDescriptor<>("flash", "EABB4D", ElectricityProducerAsset.class);
@@ -61,58 +38,4 @@ public class ElectricityProducerAsset extends Asset<ElectricityProducerAsset> {
public ElectricityProducerAsset(String name) {
super(name);
}
-
- public Optional<String> getStatus() {
- return getAttributes().getValue(STATUS);
- }
-
- public ElectricityProducerAsset setStatus(String value) {
- getAttributes().getOrCreate(STATUS).setValue(value);
- return this;
- }
-
- public Optional<Double> getPower() {
- return getAttributes().getValue(POWER_TOTAL);
- }
-
- public ElectricityProducerAsset setPower(Double value) {
- getAttributes().getOrCreate(POWER_TOTAL).setValue(value);
- return this;
- }
-
- public Optional<Double> getPowerForecastDeviation() {
- return getAttributes().getValue(POWER_FORECAST_DEVIATION);
- }
-
- public ElectricityProducerAsset setPowerForecastDeviation(Double value) {
- getAttributes().getOrCreate(POWER_FORECAST_DEVIATION).setValue(value);
- return this;
- }
-
- public Optional<Double> getPowerCapacity() {
- return getAttributes().getValue(POWER_CAPACITY);
- }
-
- public ElectricityProducerAsset setPowerCapacity(Double value) {
- getAttributes().getOrCreate(POWER_CAPACITY).setValue(value);
- return this;
- }
-
- public Optional<Integer> getEfficiency() {
- return getAttributes().getValue(EFFICIENCY);
- }
-
- public ElectricityProducerAsset setEfficiency(Integer value) {
- getAttributes().getOrCreate(EFFICIENCY).setValue(value);
- return this;
- }
-
- public Optional<Double> getEnergyTotal() {
- return getAttributes().getValue(ENERGY_TOTAL);
- }
-
- public ElectricityProducerAsset setEnergyTotal(Double value) {
- getAttributes().getOrCreate(ENERGY_TOTAL).setValue(value);
- return this;
- }
}
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerSolarAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerSolarAsset.java
index 25f5403af..f882662f1 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerSolarAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerSolarAsset.java
@@ -45,9 +45,9 @@ public class ElectricityProducerSolarAsset extends ElectricityProducerAsset {
public static final ValueDescriptor<PanelOrientation> PANEL_ORIENTATION_VALUE = new ValueDescriptor<>("panelOrientation", PanelOrientation.class);
public static final AttributeDescriptor<PanelOrientation> PANEL_ORIENTATION = new AttributeDescriptor<>("panelOrientation", PANEL_ORIENTATION_VALUE);
- public static final AttributeDescriptor<Double> PANEL_AZIMUTH = new AttributeDescriptor<>("panelAzimuth", ValueType.POSITIVE_NUMBER
+ public static final AttributeDescriptor<Integer> PANEL_AZIMUTH = new AttributeDescriptor<>("panelAzimuth", ValueType.POSITIVE_INTEGER
).withUnits(UNITS_DEGREE);
- public static final AttributeDescriptor<Double> PANEL_PITCH = new AttributeDescriptor<>("panelPitch", ValueType.POSITIVE_NUMBER
+ public static final AttributeDescriptor<Integer> PANEL_PITCH = new AttributeDescriptor<>("panelPitch", ValueType.POSITIVE_INTEGER
).withUnits(UNITS_DEGREE);
public static final AssetDescriptor<ElectricityProducerSolarAsset> DESCRIPTOR = new AssetDescriptor<>("white-balance-sunny", "8A293D", ElectricityProducerSolarAsset.class);
@@ -63,60 +63,150 @@ public class ElectricityProducerSolarAsset extends ElectricityProducerAsset {
super(name);
}
- public ElectricityProducerSolarAsset setStatus(String value) {
- getAttributes().getOrCreate(STATUS).setValue(value);
+ public Optional<PanelOrientation> getPanelOrientation() {
+ return getAttributes().getValue(PANEL_ORIENTATION);
+ }
+
+ public ElectricityProducerSolarAsset setPanelOrientation(PanelOrientation value) {
+ getAttributes().getOrCreate(PANEL_ORIENTATION).setValue(value);
+ return this;
+ }
+
+ public Optional<Integer> getPanelAzimuth() {
+ return getAttributes().getValue(PANEL_AZIMUTH);
+ }
+
+ public ElectricityProducerSolarAsset setPanelAzimuth(Integer value) {
+ getAttributes().getOrCreate(PANEL_AZIMUTH).setValue(value);
+ return this;
+ }
+
+ public Optional<Integer> getPanelPitch() {
+ return getAttributes().getValue(PANEL_PITCH);
+ }
+
+ public ElectricityProducerSolarAsset setPanelPitch(Integer value) {
+ getAttributes().getOrCreate(PANEL_PITCH).setValue(value);
return this;
}
+ @Override
public ElectricityProducerSolarAsset setPower(Double value) {
- getAttributes().getOrCreate(POWER_TOTAL).setValue(value);
+ super.setPower(value);
return this;
}
- public ElectricityProducerSolarAsset setPowerForecastDeviation(Double value) {
- getAttributes().getOrCreate(POWER_FORECAST_DEVIATION).setValue(value);
+ @Override
+ public ElectricityProducerSolarAsset setPowerSetpoint(Double value) {
+ super.setPowerSetpoint(value);
return this;
}
- public ElectricityProducerSolarAsset setPowerCapacity(Double value) {
- getAttributes().getOrCreate(POWER_CAPACITY).setValue(value);
+ @Override
+ public ElectricityProducerSolarAsset setPowerImportMin(Double value) {
+ super.setPowerImportMin(value);
return this;
}
- public ElectricityProducerSolarAsset setEfficiency(Integer value) {
- getAttributes().getOrCreate(EFFICIENCY).setValue(value);
+ @Override
+ public ElectricityProducerSolarAsset setPowerImportMax(Double value) {
+ super.setPowerImportMax(value);
return this;
}
- public ElectricityProducerSolarAsset setEnergyTotal(Double value) {
- getAttributes().getOrCreate(ENERGY_TOTAL).setValue(value);
+ @Override
+ public ElectricityProducerSolarAsset setPowerExportMin(Double value) {
+ super.setPowerExportMin(value);
return this;
}
- public Optional<PanelOrientation> getPanelOrientation() {
- return getAttributes().getValue(PANEL_ORIENTATION);
+ @Override
+ public ElectricityProducerSolarAsset setPowerExportMax(Double value) {
+ super.setPowerExportMax(value);
+ return this;
}
- public ElectricityProducerSolarAsset setPanelOrientation(PanelOrientation value) {
- getAttributes().getOrCreate(PANEL_ORIENTATION).setValue(value);
+ @Override
+ public ElectricityProducerSolarAsset setEnergyImportTotal(Double value) {
+ super.setEnergyImportTotal(value);
return this;
}
- public Optional<Double> getPanelAzimuth() {
- return getAttributes().getValue(PANEL_AZIMUTH);
+ @Override
+ public ElectricityProducerSolarAsset setEnergyExportTotal(Double value) {
+ super.setEnergyExportTotal(value);
+ return this;
}
- public ElectricityProducerSolarAsset setPanelAzimuth(Double value) {
- getAttributes().getOrCreate(PANEL_AZIMUTH).setValue(value);
+ @Override
+ public ElectricityProducerSolarAsset setEnergyCapacity(Double value) {
+ super.setEnergyCapacity(value);
return this;
}
- public Optional<Double> getPanelPitch() {
- return getAttributes().getValue(PANEL_PITCH);
+ @Override
+ public ElectricityProducerSolarAsset setEnergyLevel(Double value) {
+ super.setEnergyLevel(value);
+ return this;
}
- public ElectricityProducerSolarAsset setPanelPitch(Double value) {
- getAttributes().getOrCreate(PANEL_PITCH).setValue(value);
+ @Override
+ public ElectricityProducerSolarAsset setEnergyLevelPercentage(Integer value) {
+ super.setEnergyLevelPercentage(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerSolarAsset setEnergyLevelPercentageMin(Integer value) {
+ super.setEnergyLevelPercentageMin(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerSolarAsset setEnergyLevelPercentageMax(Integer value) {
+ super.setEnergyLevelPercentageMax(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerSolarAsset setEfficiencyImport(Integer value) {
+ super.setEfficiencyImport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerSolarAsset setEfficiencyExport(Integer value) {
+ super.setEfficiencyExport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerSolarAsset setTariffImport(Double value) {
+ super.setTariffImport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerSolarAsset setTariffExport(Double value) {
+ super.setTariffExport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerSolarAsset setCarbonImport(Double value) {
+ super.setCarbonImport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerSolarAsset setCarbonExport(Double value) {
+ super.setCarbonExport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerSolarAsset setCarbonTotal(Integer value) {
+ super.setCarbonTotal(value);
return this;
}
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerWindAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerWindAsset.java
index a958d3f90..11e32a968 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerWindAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityProducerWindAsset.java
@@ -41,6 +41,126 @@ public class ElectricityProducerWindAsset extends ElectricityProducerAsset {
}
+ @Override
+ public ElectricityProducerWindAsset setPower(Double value) {
+ super.setPower(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setPowerSetpoint(Double value) {
+ super.setPowerSetpoint(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setPowerImportMin(Double value) {
+ super.setPowerImportMin(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setPowerImportMax(Double value) {
+ super.setPowerImportMax(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setPowerExportMin(Double value) {
+ super.setPowerExportMin(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setPowerExportMax(Double value) {
+ super.setPowerExportMax(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setEnergyImportTotal(Double value) {
+ super.setEnergyImportTotal(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setEnergyExportTotal(Double value) {
+ super.setEnergyExportTotal(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setEnergyCapacity(Double value) {
+ super.setEnergyCapacity(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setEnergyLevel(Double value) {
+ super.setEnergyLevel(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setEnergyLevelPercentage(Integer value) {
+ super.setEnergyLevelPercentage(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setEnergyLevelPercentageMin(Integer value) {
+ super.setEnergyLevelPercentageMin(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setEnergyLevelPercentageMax(Integer value) {
+ super.setEnergyLevelPercentageMax(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setEfficiencyImport(Integer value) {
+ super.setEfficiencyImport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setEfficiencyExport(Integer value) {
+ super.setEfficiencyExport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setTariffImport(Double value) {
+ super.setTariffImport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setTariffExport(Double value) {
+ super.setTariffExport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setCarbonImport(Double value) {
+ super.setCarbonImport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setCarbonExport(Double value) {
+ super.setCarbonExport(value);
+ return this;
+ }
+
+ @Override
+ public ElectricityProducerWindAsset setCarbonTotal(Integer value) {
+ super.setCarbonTotal(value);
+ return this;
+ }
+
@Override
public ElectricityProducerWindAsset setId(String id) {
super.setId(id);
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricityStorageAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricityStorageAsset.java
index d8e38f017..3c77287e7 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricityStorageAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricityStorageAsset.java
@@ -19,66 +19,22 @@
*/
package org.openremote.model.asset.impl;
-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.ValueConstraint;
import org.openremote.model.value.ValueType;
import javax.persistence.Entity;
import java.util.Optional;
-import static org.openremote.model.Constants.*;
-
@Entity
-public class ElectricityStorageAsset extends Asset<ElectricityStorageAsset> {
+public class ElectricityStorageAsset extends ElectricityAsset<ElectricityStorageAsset> {
- public static final AttributeDescriptor<String> STATUS = new AttributeDescriptor<>("status", ValueType.TEXT,
- new MetaItem<>(MetaItemType.READ_ONLY)
- );
- public static final AttributeDescriptor<Double> LEVELISED_COST_OF_STORAGE = new AttributeDescriptor<>("levelisedCostOfStorage", ValueType.POSITIVE_NUMBER)
- .withUnits("EUR", UNITS_PER, UNITS_KILO, UNITS_WATT, UNITS_HOUR);
- public static final AttributeDescriptor<Double> ENERGY_CAPACITY = new AttributeDescriptor<>("energyCapacity", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
- public static final AttributeDescriptor<Integer> ENERGY_LEVEL_PERCENTAGE = new AttributeDescriptor<>("energyLevelPercentage", ValueType.POSITIVE_INTEGER)
- .withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
- public static final AttributeDescriptor<Integer> ENERGY_LEVEL_MAX_PERCENTAGE = new AttributeDescriptor<>("energyLevelMaxPercentage", ValueType.POSITIVE_INTEGER)
- .withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
- public static final AttributeDescriptor<Integer> ENERGY_LEVEL_MIN_PERCENTAGE = new AttributeDescriptor<>("energyLevelMinPercentage", ValueType.POSITIVE_INTEGER)
- .withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
- public static final AttributeDescriptor<Double> ENERGY_LEVEL = new AttributeDescriptor<>("energyLevel", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
- public static final AttributeDescriptor<Double> ENERGY_TOTAL_IMPORT = new AttributeDescriptor<>("energyTotalImport", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
- public static final AttributeDescriptor<Double> ENERGY_TOTAL_EXPORT = new AttributeDescriptor<>("energyTotalExport", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
- public static final AttributeDescriptor<Double> POWER_CAPACITY_IMPORT = new AttributeDescriptor<>("powerCapacityImport", ValueType.POSITIVE_NUMBER)
- .withUnits(UNITS_KILO, UNITS_WATT);
- public static final AttributeDescriptor<Double> POWER_CAPACITY_EXPORT = new AttributeDescriptor<>("powerCapacityExport", ValueType.POSITIVE_NUMBER)
- .withUnits(UNITS_KILO, UNITS_WATT);
- public static final AttributeDescriptor<Double> POWER_TOTAL = 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)
- .withUnits(UNITS_KILO, UNITS_WATT);
public static final AttributeDescriptor<Integer> CHARGE_CYCLES = new AttributeDescriptor<>("chargeCycles", ValueType.POSITIVE_INTEGER,
new MetaItem<>(MetaItemType.READ_ONLY)
);
- public static final AttributeDescriptor<Integer> CHARGE_EFFICIENCY = new AttributeDescriptor<>("chargeEfficiency", ValueType.POSITIVE_INTEGER)
- .withUnits(UNITS_PERCENTAGE).withConstraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100));
-
- public static final AttributeDescriptor<Double> FINANCIAL_WALLET = new AttributeDescriptor<>("financialWallet", ValueType.POSITIVE_NUMBER).withUnits("EUR");
- public static final AttributeDescriptor<Integer> CARBON_WALLET = new AttributeDescriptor<>("carbonWallet", ValueType.POSITIVE_INTEGER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- ).withUnits(UNITS_KILO, UNITS_GRAM);
-
public static final AssetDescriptor<ElectricityStorageAsset> DESCRIPTOR = new AssetDescriptor<>("battery-charging", "1B7C89", ElectricityStorageAsset.class);
/**
@@ -92,101 +48,12 @@ public class ElectricityStorageAsset extends Asset<ElectricityStorageAsset> {
super(name);
}
- public Optional<String> getStatus() {
- return getAttributes().getValue(STATUS);
- }
-
- public Optional<Double> getLevelisedCostOfStorage() {
- return getAttributes().getValue(LEVELISED_COST_OF_STORAGE);
- }
-
- public Optional<Double> getEnergyCapacity() {
- return getAttributes().getValue(ENERGY_CAPACITY);
- }
-
- public Optional<Integer> getEnergyLevelPercentage() {
- return getAttributes().getValue(ENERGY_LEVEL_PERCENTAGE);
- }
-
- public Optional<Double> getEnergyLevel() {
- return getAttributes().getValue(ENERGY_LEVEL);
- }
-
- public Optional<Integer> getEnergyLevelMinPercentage() {
- return getAttributes().getValue(ENERGY_LEVEL_MIN_PERCENTAGE);
- }
-
- public Optional<Integer> getEnergyLevelMaxPercentage() {
- return getAttributes().getValue(ENERGY_LEVEL_MAX_PERCENTAGE);
- }
-
- public Optional<Double> getEnergyTotalImport() {
- return getAttributes().getValue(ENERGY_TOTAL_IMPORT);
- }
-
- public Optional<Double> getEnergyTotalExport() {
- return getAttributes().getValue(ENERGY_TOTAL_EXPORT);
- }
-
- public Optional<Double> getPowerCapacityImport() {
- return getAttributes().getValue(POWER_CAPACITY_IMPORT);
- }
-
- public Optional<Double> getPowerCapacityExport() {
- return getAttributes().getValue(POWER_CAPACITY_EXPORT);
- }
-
- public Optional<Double> getPower() {
- return getAttributes().getValue(POWER_TOTAL);
- }
-
- public Optional<Double> getPowerSetpoint() {
- return getAttributes().getValue(POWER_SETPOINT);
- }
-
public Optional<Integer> getChargeCycles() {
return getAttributes().getValue(CHARGE_CYCLES);
}
- public Optional<Double> getFinancialWallet() {
- return getAttributes().getValue(FINANCIAL_WALLET);
- }
-
- public Optional<Integer> getCarbonWallet() {
- return getAttributes().getValue(CARBON_WALLET);
- }
-
- public Optional<Integer> getChargeEfficiency() {
- return getAttributes().getValue(CHARGE_EFFICIENCY);
- }
-
- @SuppressWarnings("unchecked")
- public <T extends ElectricityStorageAsset> T setEnergyLevelPercentage(Integer value) {
- getAttributes().getOrCreate(ENERGY_LEVEL_PERCENTAGE).setValue(value);
- return (T)this;
- }
-
- @SuppressWarnings("unchecked")
- public <T extends ElectricityStorageAsset> T setEnergyLevel(Double value) {
- getAttributes().getOrCreate(ENERGY_LEVEL).setValue(value);
- return (T)this;
- }
-
- @SuppressWarnings("unchecked")
- public <T extends ElectricityStorageAsset> T setEnergyTotalImport(Double value) {
- getAttributes().getOrCreate(ENERGY_TOTAL_IMPORT).setValue(value);
- return (T)this;
- }
-
- @SuppressWarnings("unchecked")
- public <T extends ElectricityStorageAsset> T setEnergyTotalExport(Double value) {
- getAttributes().getOrCreate(ENERGY_TOTAL_EXPORT).setValue(value);
- return (T)this;
- }
-
- @SuppressWarnings("unchecked")
- public <T extends ElectricityStorageAsset> T setPowerTotal(Double value) {
- getAttributes().getOrCreate(POWER_TOTAL).setValue(value);
- return (T)this;
+ public ElectricityStorageAsset setChargeCycles(Integer value) {
+ getAttributes().getOrCreate(CHARGE_CYCLES).setValue(value);
+ return this;
}
}
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ElectricitySupplierAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ElectricitySupplierAsset.java
index 7d9e32a62..7d2d6d7c5 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ElectricitySupplierAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ElectricitySupplierAsset.java
@@ -19,7 +19,6 @@
*/
package org.openremote.model.asset.impl;
-import org.openremote.model.asset.Asset;
import org.openremote.model.asset.AssetDescriptor;
import org.openremote.model.attribute.MetaItem;
import org.openremote.model.value.AttributeDescriptor;
@@ -29,64 +28,18 @@ import org.openremote.model.value.ValueType;
import javax.persistence.Entity;
import java.util.Optional;
-import static org.openremote.model.Constants.*;
+import static org.openremote.model.Constants.UNITS_GRAM;
+import static org.openremote.model.Constants.UNITS_KILO;
@Entity
-public class ElectricitySupplierAsset extends Asset<ElectricitySupplierAsset> {
+public class ElectricitySupplierAsset extends ElectricityAsset<ElectricitySupplierAsset> {
- public static final AttributeDescriptor<String> STATUS = new AttributeDescriptor<>("status", ValueType.TEXT,
- new MetaItem<>(MetaItemType.READ_ONLY)
- );
- public static final AttributeDescriptor<Double> POWER_CAPACITY = new AttributeDescriptor<>("powerCapacity", ValueType.POSITIVE_NUMBER)
- .withUnits(UNITS_KILO, UNITS_WATT);
- public static final AttributeDescriptor<Double> POWER_EDR_SETPOINT = new AttributeDescriptor<>("powerEDRSetpoint", ValueType.POSITIVE_NUMBER)
- .withUnits(UNITS_KILO, UNITS_WATT);
- public static final AttributeDescriptor<Double> POWER_EDR_RESERVE = new AttributeDescriptor<>("powerEDRReserve", ValueType.POSITIVE_NUMBER)
- .withUnits(UNITS_KILO, UNITS_WATT);
- public static final AttributeDescriptor<Integer> POWER_EDR_MIN_PERIOD = new AttributeDescriptor<>("powerEDRMinPeriod", ValueType.POSITIVE_INTEGER)
- .withUnits(UNITS_SECOND);
- public static final AttributeDescriptor<Double> TARIFF_IMPORT = new AttributeDescriptor<>("tariffImport", ValueType.POSITIVE_NUMBER)
- .withUnits("EUR", UNITS_PER, UNITS_KILO, UNITS_WATT, UNITS_HOUR);
- public static final AttributeDescriptor<Double> TARIFF_EXPORT = new AttributeDescriptor<>("tariffExport", ValueType.POSITIVE_NUMBER)
- .withUnits("EUR", UNITS_PER, UNITS_KILO, UNITS_WATT, UNITS_HOUR);
-
- public static final AttributeDescriptor<Double> ENERGY_TARIFF_IMPORT_FORECAST_DEVIATION = new AttributeDescriptor<>("tariffImportForecastDeviation", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- );
- public static final AttributeDescriptor<Double> ENERGY_TARIFF_EXPORT_FORECAST_DEVIATION = new AttributeDescriptor<>("tariffExportForecastDeviation", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY)
- );
- public static final AttributeDescriptor<Double> ENERGY_TAX = new AttributeDescriptor<>("energyTax", ValueType.POSITIVE_NUMBER)
- .withUnits("EUR", UNITS_PER, UNITS_KILO, UNITS_WATT, UNITS_HOUR);
- public static final AttributeDescriptor<Double> GRID_COST = new AttributeDescriptor<>("gridCost", ValueType.POSITIVE_NUMBER)
- .withUnits("EUR");
- public static final AttributeDescriptor<Double> GRID_CONNECTION_COST = new AttributeDescriptor<>("gridConnectionCost", ValueType.POSITIVE_NUMBER)
- .withUnits("EUR");
- public static final AttributeDescriptor<Double> CARBON_IMPORT = new AttributeDescriptor<>("carbonImport", ValueType.POSITIVE_NUMBER)
- .withUnits(UNITS_KILO, UNITS_GRAM, UNITS_PER, UNITS_KILO, UNITS_WATT, UNITS_HOUR);
- 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<Double> POWER_TOTAL = new AttributeDescriptor<>("power", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY, true)
- ).withUnits(UNITS_KILO, UNITS_WATT);
- public static final AttributeDescriptor<Double> POWER_FORECAST_DEVIATION = new AttributeDescriptor<>("powerForecastDeviation", ValueType.NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY, true)
- ).withUnits(UNITS_KILO, UNITS_WATT);
- public static final AttributeDescriptor<Double> ENERGY_TOTAL_IMPORT = new AttributeDescriptor<>("energyTotalImport", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY, true)
- ).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
- public static final AttributeDescriptor<Double> ENERGY_TOTAL_EXPORT = new AttributeDescriptor<>("energyTotalExport", ValueType.POSITIVE_NUMBER,
- new MetaItem<>(MetaItemType.READ_ONLY, true)
- ).withUnits(UNITS_KILO, UNITS_WATT, UNITS_HOUR);
- public static final AttributeDescriptor<Double> ENERGY_TOTAL_IMPORT_COST = new AttributeDescriptor<>("energyTotalImportCost", ValueType.POSITIVE_NUMBER,
+ public static final AttributeDescriptor<Double> ENERGY_IMPORT_COST = new AttributeDescriptor<>("energyImportCost", ValueType.POSITIVE_NUMBER,
new MetaItem<>(MetaItemType.READ_ONLY, true)
).withUnits("EUR");
- public static final AttributeDescriptor<Double> ENERGY_TOTAL_EXPORT_INCOME = new AttributeDescriptor<>("energyTotalExportIncome", ValueType.POSITIVE_NUMBER,
+ public static final AttributeDescriptor<Double> ENERGY_EXPORT_INCOME = new AttributeDescriptor<>("energyExportIncome", ValueType.POSITIVE_NUMBER,
new MetaItem<>(MetaItemType.READ_ONLY, true)
).withUnits("EUR");
- public static final AttributeDescriptor<Integer> CARBON_TOTAL = new AttributeDescriptor<>("carbonTotal", ValueType.POSITIVE_INTEGER,
- new MetaItem<>(MetaItemType.READ_ONLY, true)
- ).withUnits(UNITS_KILO, UNITS_GRAM);
public static final AttributeDescriptor<Double> FINANCIAL_WALLET = new AttributeDescriptor<>("financialWallet", ValueType.POSITIVE_NUMBER).withUnits("EUR");
public static final AttributeDescriptor<Integer> CARBON_WALLET = new AttributeDescriptor<>("carbonWallet", ValueType.POSITIVE_INTEGER,
new MetaItem<>(MetaItemType.READ_ONLY)
@@ -105,87 +58,19 @@ public class ElectricitySupplierAsset extends Asset<ElectricitySupplierAsset> {
super(name);
}
- public Optional<String> getStatus() {
- return getAttributes().getValue(STATUS);
- }
-
- public Optional<Double> getPowerCapacity() {
- return getAttributes().getValue(POWER_CAPACITY);
- }
-
- public Optional<Double> getPowerEDRSetpoint() {
- return getAttributes().getValue(POWER_EDR_SETPOINT);
- }
-
- public Optional<Double> getPowerEDRReserve() {
- return getAttributes().getValue(POWER_EDR_RESERVE);
- }
-
- public Optional<Integer> getPowerEDRMinPeriod() {
- return getAttributes().getValue(POWER_EDR_MIN_PERIOD);
- }
-
- public Optional<Double> getTariffImport() {
- return getAttributes().getValue(TARIFF_IMPORT);
- }
-
- public Optional<Double> getTariffExport() {
- return getAttributes().getValue(TARIFF_EXPORT);
- }
-
- public Optional<Double> getEnergyTariffImportForecastDeviation() {
- return getAttributes().getValue(ENERGY_TARIFF_IMPORT_FORECAST_DEVIATION);
- }
-
- public Optional<Double> getEnergyTariffExportForecastDeviation() {
- return getAttributes().getValue(ENERGY_TARIFF_EXPORT_FORECAST_DEVIATION);
- }
-
- public Optional<Double> getEnergyTax() {
- return getAttributes().getValue(ENERGY_TAX);
- }
-
- public Optional<Double> getGridCost() {
- return getAttributes().getValue(GRID_COST);
- }
-
- public Optional<Double> getGridConnectionCost() {
- return getAttributes().getValue(GRID_CONNECTION_COST);
- }
-
- public Optional<Double> getCarbonImport() {
- return getAttributes().getValue(CARBON_IMPORT);
- }
-
- public Optional<Double> getCarbonExport() {
- return getAttributes().getValue(CARBON_EXPORT);
- }
-
- public Optional<Double> getPower() {
- return getAttributes().getValue(POWER_TOTAL);
- }
-
- public Optional<Double> getPowerForecastDeviation() {
- return getAttributes().getValue(POWER_FORECAST_DEVIATION);
- }
-
- public Optional<Double> getEnergyTotalImport() {
- return getAttributes().getValue(ENERGY_TOTAL_IMPORT);
- }
-
- public Optional<Double> getEnergyTotalExport() {
- return getAttributes().getValue(ENERGY_TOTAL_EXPORT);
+ public Optional<Double> getEnergyImportCost() {
+ return getAttributes().getValue(ENERGY_IMPORT_COST);
}
- public Optional<Double> getEnergyTotalImportCost() {
- return getAttributes().getValue(ENERGY_TOTAL_IMPORT_COST);
+ public Optional<Double> getEnergyExportIncome() {
+ return getAttributes().getValue(ENERGY_EXPORT_INCOME);
}
- public Optional<Double> getEnergyTotalExportIncome() {
- return getAttributes().getValue(ENERGY_TOTAL_EXPORT_INCOME);
+ public Optional<Double> getFinancialWallet() {
+ return getAttributes().getValue(FINANCIAL_WALLET);
}
- public Optional<Integer> getCarbonTotal() {
- return getAttributes().getValue(CARBON_TOTAL);
+ public Optional<Integer> getCarbonWallet() {
+ return getAttributes().getValue(CARBON_WALLET);
}
}
diff --git a/model/src/main/java/org/openremote/model/asset/impl/LightAsset.java b/model/src/main/java/org/openremote/model/asset/impl/LightAsset.java
index d3981fe38..50965e178 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/LightAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/LightAsset.java
@@ -61,39 +61,35 @@ public class LightAsset extends Asset<LightAsset> {
return getAttributes().getValue(ON_OFF);
}
- @SuppressWarnings("unchecked")
- public <T extends LightAsset> T setOnOff(Boolean value) {
+ public LightAsset setOnOff(Boolean value) {
getAttributes().getOrCreate(ON_OFF).setValue(value);
- return (T)this;
+ return this;
}
public Optional<Integer> getBrightness() {
return getAttributes().getValue(BRIGHTNESS);
}
- @SuppressWarnings("unchecked")
- public <T extends LightAsset> T setBrightness(Integer value) {
+ public LightAsset setBrightness(Integer value) {
getAttributes().getOrCreate(BRIGHTNESS).setValue(value);
- return (T)this;
+ return this;
}
public Optional<ColourRGB> getColourRGB() {
return getAttributes().getValue(COLOUR_RGB);
}
- @SuppressWarnings("unchecked")
- public <T extends LightAsset> T setColourRGB(ColourRGB value) {
+ public LightAsset setColourRGB(ColourRGB value) {
getAttributes().getOrCreate(COLOUR_RGB).setValue(value);
- return (T)this;
+ return this;
}
public Optional<Integer> getTemperature() {
return getAttributes().getValue(COLOUR_TEMPERATURE);
}
- @SuppressWarnings("unchecked")
- public <T extends LightAsset> T setTemperature(Integer value) {
+ public LightAsset setTemperature(Integer value) {
getAttributes().getOrCreate(COLOUR_TEMPERATURE).setValue(value);
- return (T)this;
+ return this;
}
}
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ParkingAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ParkingAsset.java
index e3d8bc263..a98f7b55d 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ParkingAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ParkingAsset.java
@@ -56,59 +56,53 @@ public class ParkingAsset extends Asset<ParkingAsset> {
return getAttributes().getValue(SPACES_TOTAL);
}
- @SuppressWarnings("unchecked")
- public <T extends ParkingAsset> T setSpacesTotal(Integer value) {
+ public ParkingAsset setSpacesTotal(Integer value) {
getAttributes().getOrCreate(SPACES_TOTAL).setValue(value);
- return (T)this;
+ return this;
}
public Optional<Integer> getSpacesOccupied() {
return getAttributes().getValue(SPACES_OCCUPIED);
}
- @SuppressWarnings("unchecked")
- public <T extends ParkingAsset> T setSpacesOccupied(Integer value) {
+ public ParkingAsset setSpacesOccupied(Integer value) {
getAttributes().getOrCreate(SPACES_OCCUPIED).setValue(value);
- return (T)this;
+ return this;
}
public Optional<Integer> getSpacesOpen() {
return getAttributes().getValue(SPACES_OPEN);
}
- @SuppressWarnings("unchecked")
- public <T extends ParkingAsset> T setSpacesOpen(Integer value) {
+ public ParkingAsset setSpacesOpen(Integer value) {
getAttributes().getOrCreate(SPACES_OPEN).setValue(value);
- return (T)this;
+ return this;
}
public Optional<Integer> getSpacesBuffer() {
return getAttributes().getValue(SPACES_BUFFER);
}
- @SuppressWarnings("unchecked")
- public <T extends ParkingAsset> T setSpacesBuffer(Integer value) {
+ public ParkingAsset setSpacesBuffer(Integer value) {
getAttributes().getOrCreate(SPACES_BUFFER).setValue(value);
- return (T)this;
+ return this;
}
public Optional<Double> getPriceHourly() {
return getAttributes().getValue(PRICE_HOURLY);
}
- @SuppressWarnings("unchecked")
- public <T extends ParkingAsset> T setPriceHourly(Double value) {
+ public ParkingAsset setPriceHourly(Double value) {
getAttributes().getOrCreate(PRICE_HOURLY).setValue(value);
- return (T)this;
+ return this;
}
public Optional<Double> getPriceDaily() {
return getAttributes().getValue(PRICE_DAILY);
}
- @SuppressWarnings("unchecked")
- public <T extends ParkingAsset> T setPriceDaily(Double value) {
+ public ParkingAsset setPriceDaily(Double value) {
getAttributes().getOrCreate(PRICE_DAILY).setValue(value);
- return (T)this;
+ return this;
}
}
diff --git a/model/src/main/java/org/openremote/model/asset/impl/ShipAsset.java b/model/src/main/java/org/openremote/model/asset/impl/ShipAsset.java
index b20c3f066..e3358a236 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/ShipAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/ShipAsset.java
@@ -58,10 +58,9 @@ public class ShipAsset extends Asset<ShipAsset> {
return getAttributes().getValue(MSSI_NUMBER);
}
- @SuppressWarnings("unchecked")
- public <T extends ShipAsset> T setMSSINumber(Integer value) {
+ public ShipAsset setMSSINumber(Integer value) {
getAttributes().getOrCreate(MSSI_NUMBER).setValue(value);
- return (T)this;
+ return this;
}
public Optional<Integer> getIMONumber() {
@@ -69,48 +68,44 @@ public class ShipAsset extends Asset<ShipAsset> {
}
@SuppressWarnings("unchecked")
- public <T extends ShipAsset> T setIMONumber(Integer value) {
+ public ShipAsset setIMONumber(Integer value) {
getAttributes().getOrCreate(IMO_NUMBER).setValue(value);
- return (T)this;
+ return this;
}
public Optional<Integer> getDirection() {
return getAttributes().getValue(DIRECTION);
}
- @SuppressWarnings("unchecked")
- public <T extends ShipAsset> T setDirection(Integer value) {
+ public ShipAsset setDirection(Integer value) {
getAttributes().getOrCreate(DIRECTION).setValue(value);
- return (T)this;
+ return this;
}
public Optional<Integer> getLength() {
return getAttributes().getValue(LENGTH);
}
- @SuppressWarnings("unchecked")
- public <T extends ShipAsset> T setLength(Integer value) {
+ public ShipAsset setLength(Integer value) {
getAttributes().getOrCreate(LENGTH).setValue(value);
- return (T)this;
+ return this;
}
public Optional<Double> getSpeed() {
return getAttributes().getValue(SPEED);
}
- @SuppressWarnings("unchecked")
- public <T extends ShipAsset> T setSpeed(Double value) {
+ public ShipAsset setSpeed(Double value) {
getAttributes().getOrCreate(SPEED).setValue(value);
- return (T)this;
+ return this;
}
public Optional<String> getShipType() {
return getAttributes().getValue(SHIP_TYPE);
}
- @SuppressWarnings("unchecked")
- public <T extends ShipAsset> T setShipType(String value) {
+ public ShipAsset setShipType(String value) {
getAttributes().getOrCreate(SHIP_TYPE).setValue(value);
- return (T)this;
+ return this;
}
}
diff --git a/model/src/main/java/org/openremote/model/asset/impl/WeatherAsset.java b/model/src/main/java/org/openremote/model/asset/impl/WeatherAsset.java
index 5e6e9125a..4205c6687 100644
--- a/model/src/main/java/org/openremote/model/asset/impl/WeatherAsset.java
+++ b/model/src/main/java/org/openremote/model/asset/impl/WeatherAsset.java
@@ -38,20 +38,20 @@ public class WeatherAsset extends Asset<WeatherAsset> {
public static final AttributeDescriptor<Double> TEMPERATURE = new AttributeDescriptor<>("temperature", ValueType.NUMBER,
new MetaItem<>(MetaItemType.READ_ONLY)
).withUnits(UNITS_CELSIUS);
- public static final AttributeDescriptor<Double> UV_INDEX = new AttributeDescriptor<>("uVIndex", ValueType.POSITIVE_NUMBER,
+ public static final AttributeDescriptor<Integer> UV_INDEX = new AttributeDescriptor<>("uVIndex", ValueType.POSITIVE_INTEGER,
new MetaItem<>(MetaItemType.LABEL, "UV index"),
new MetaItem<>(MetaItemType.READ_ONLY)
);
- public static final AttributeDescriptor<Double> SUN_IRRADIANCE = new AttributeDescriptor<>("sunIrradiance", ValueType.POSITIVE_NUMBER,
+ public static final AttributeDescriptor<Integer> SUN_IRRADIANCE = new AttributeDescriptor<>("sunIrradiance", ValueType.POSITIVE_INTEGER,
new MetaItem<>(MetaItemType.READ_ONLY)
);
- public static final AttributeDescriptor<Double> SUN_AZIMUTH = new AttributeDescriptor<>("sunAzimuth", ValueType.POSITIVE_NUMBER,
+ public static final AttributeDescriptor<Integer> SUN_AZIMUTH = new AttributeDescriptor<>("sunAzimuth", ValueType.POSITIVE_INTEGER,
new MetaItem<>(MetaItemType.READ_ONLY)
);
- public static final AttributeDescriptor<Double> SUN_ZENITH = new AttributeDescriptor<>("sunZenith", ValueType.POSITIVE_NUMBER,
+ public static final AttributeDescriptor<Integer> SUN_ZENITH = new AttributeDescriptor<>("sunZenith", ValueType.POSITIVE_INTEGER,
new MetaItem<>(MetaItemType.READ_ONLY)
);
- public static final AttributeDescriptor<Double> SUN_ALTITUDE = new AttributeDescriptor<>("sunAltitude", ValueType.POSITIVE_NUMBER,
+ public static final AttributeDescriptor<Integer> SUN_ALTITUDE = new AttributeDescriptor<>("sunAltitude", ValueType.POSITIVE_INTEGER,
new MetaItem<>(MetaItemType.READ_ONLY)
);
public static final AttributeDescriptor<Double> WIND_SPEED = new AttributeDescriptor<>("windSpeed", ValueType.POSITIVE_NUMBER,
@@ -84,23 +84,23 @@ public class WeatherAsset extends Asset<WeatherAsset> {
return getAttributes().getValue(TEMPERATURE);
}
- public Optional<Double> getUVIndex() {
+ public Optional<Integer> getUVIndex() {
return getAttributes().getValue(UV_INDEX);
}
- public Optional<Double> getSunIrradiance() {
+ public Optional<Integer> getSunIrradiance() {
return getAttributes().getValue(SUN_IRRADIANCE);
}
- public Optional<Double> getSunAzimuth() {
+ public Optional<Integer> getSunAzimuth() {
return getAttributes().getValue(SUN_AZIMUTH);
}
- public Optional<Double> getSunZenith() {
+ public Optional<Integer> getSunZenith() {
return getAttributes().getValue(SUN_ZENITH);
}
- public Optional<Double> getSunAltitude() {
+ public Optional<Integer> getSunAltitude() {
return getAttributes().getValue(SUN_ALTITUDE);
}
diff --git a/test/src/main/groovy/org/openremote/test/protocol/MockAgent.java b/test/src/main/groovy/org/openremote/test/protocol/MockAgent.java
index 480ffcfcc..32545634f 100644
--- a/test/src/main/groovy/org/openremote/test/protocol/MockAgent.java
+++ b/test/src/main/groovy/org/openremote/test/protocol/MockAgent.java
@@ -46,10 +46,9 @@ public class MockAgent extends Agent<MockAgent, MockProtocol, MockAgent.MockAgen
return Optional.ofNullable(requiredValue);
}
- @SuppressWarnings("unchecked")
- public <T extends MockAgentLink> T setRequiredValue(String requiredValue) {
+ public MockAgentLink setRequiredValue(String requiredValue) {
this.requiredValue = requiredValue;
- return (T)this;
+ return this;
}
}
@@ -74,10 +73,9 @@ public class MockAgent extends Agent<MockAgent, MockProtocol, MockAgent.MockAgen
return getAttributes().getValue(REQUIRED);
}
- @SuppressWarnings("unchecked")
- public <T extends MockAgent> T setRequired(Boolean value) {
+ public MockAgent setRequired(Boolean value) {
getAttributes().getOrCreate(REQUIRED).setValue(value);
- return (T)this;
+ return this;
}
@Override
diff --git a/ui/demo/demo-core/src/index.ts b/ui/demo/demo-core/src/index.ts
index 9c6f39797..7cb848786 100644
--- a/ui/demo/demo-core/src/index.ts
+++ b/ui/demo/demo-core/src/index.ts
@@ -52,7 +52,7 @@ class OrDemo extends subscribe(manager)(LitElement) {
<p><b>Translation Example: </b> <or-translate value="temperature"></or-translate> <button @click="${() => this.toggleLanguage()}">${i18next.language}</button></p>
${ this.electricityConsumerAsset ? html`
- <p><b>Electricity consumer power total (${Util.resolveUnits(Util.getAttributeUnits(this.electricityConsumerAsset.attributes![WellknownAttributes.POWERTOTAL], AssetModelUtil.getAttributeDescriptor(WellknownAttributes.POWERTOTAL, WellknownAssets.ELECTRICITYCONSUMERASSET), WellknownAssets.ELECTRICITYCONSUMERASSET))}): </b> ${Util.getAttributeValueAsString(this.electricityConsumerAsset.attributes![WellknownAttributes.POWERTOTAL], AssetModelUtil.getAttributeDescriptor(WellknownAttributes.POWERTOTAL, WellknownAssets.ELECTRICITYCONSUMERASSET), WellknownAssets.ELECTRICITYCONSUMERASSET, true, "-")} </p>
+ <p><b>Electricity consumer power total (${Util.resolveUnits(Util.getAttributeUnits(this.electricityConsumerAsset.attributes![WellknownAttributes.POWER], AssetModelUtil.getAttributeDescriptor(WellknownAttributes.POWER, WellknownAssets.ELECTRICITYCONSUMERASSET), WellknownAssets.ELECTRICITYCONSUMERASSET))}): </b> ${Util.getAttributeValueAsString(this.electricityConsumerAsset.attributes![WellknownAttributes.POWER], AssetModelUtil.getAttributeDescriptor(WellknownAttributes.POWER, WellknownAssets.ELECTRICITYCONSUMERASSET), WellknownAssets.ELECTRICITYCONSUMERASSET, true, "-")} </p>
` : ``}
${ this.electricityChargerAsset ? html`