Fxied consumption
MODIFY
src/integration/asset/schneider/SchneiderAssetIntegration.ts
src/integration/asset/schneider/SchneiderAssetIntegration.ts
@@ -60,10 +60,12 @@ export default class SchneiderAssetIntegration extends AssetIntegration<AssetSet
private filterConsumptionRequest(asset: Asset, data: any[]): AbstractCurrentConsumption {
const consumption = {} as AbstractCurrentConsumption;
// Convert data value to number and get consumption
- consumption.currentConsumptionWh = this.computeNewConsumptionWh(
- asset, this.getPropertyValue(data, SchneiderProperty.ENERGY_ACTIVE));
+ const newConsumptionWh = this.getPropertyValue(data, SchneiderProperty.ENERGY_ACTIVE) * 1000;
+ if (asset.lastConsumption && asset.lastConsumption.value < newConsumptionWh) {
+ consumption.currentConsumptionWh = newConsumptionWh - asset.lastConsumption.value;
+ }
consumption.lastConsumption = {
- value: consumption.currentConsumptionWh,
+ value: newConsumptionWh,
timestamp: new Date()
};
// Amperage
@@ -119,14 +121,6 @@ export default class SchneiderAssetIntegration extends AssetIntegration<AssetSet
return params;
}
- private computeNewConsumptionWh(asset: Asset, newConsumptionkWh: number): number {
- const newConsumptionWh = newConsumptionkWh * 1000;
- if (asset.lastConsumption && asset.lastConsumption.value < newConsumptionWh) {
- return newConsumptionWh - asset.lastConsumption.value;
- }
- return 0;
- }
-
private checkConnectionIsProvided(): void {
if (!this.connection) {
throw new BackendError({

Fxied consumption