use of org.openremote.model.asset.impl.ElectricityStorageAsset in project openremote by openremote.
the class StorageSimulatorProtocol method doLinkedAttributeWrite.
@SuppressWarnings("unchecked")
@Override
protected void doLinkedAttributeWrite(Attribute<?> attribute, StorageSimulatorAgentLink agentLink, AttributeEvent event, Object processedValue) {
// Power attribute is updated only by this protocol not by clients
if (attribute.getName().equals(POWER.getName())) {
return;
}
updateLinkedAttribute(new AttributeState(event.getAttributeRef(), processedValue));
// Push write value into the asset and update
String assetId = event.getAssetId();
((Attribute<Object>) attribute).setValue(processedValue);
ElectricityStorageAsset asset = assetService.findAsset(assetId, ElectricityStorageAsset.class);
asset.addOrReplaceAttributes(attribute);
updateStorageAsset(asset);
}
Aggregations