Skip to content

Commit

Permalink
UI: Historiy Consumption Fix
Browse files Browse the repository at this point in the history
- show correct energy values for other consumption
  • Loading branch information
fabianfnc authored Jan 15, 2021
1 parent 9659109 commit 7e9a9e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
17 changes: 7 additions & 10 deletions ui/src/app/edge/history/consumption/widget.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,22 @@
</ng-container>
<ng-container *ngIf="consumptionMeterComponents.length > 0">
<ng-container *ngFor="let component of consumptionMeterComponents">
<ng-container *ngIf="data[component.id + '/ActiveConsumptionEnergy'] > 0">
<ng-container *ngIf="data[component.id + '/ActiveProductionEnergy'] > 0">
<tr>
<td style="width:65%">{{ component.alias }}</td>
<td style="width:35%" class="align_right">
{{ data[component.id + "/ActiveConsumptionEnergy"] | unitvalue:'kWh' }}
{{ data[component.id + "/ActiveProductionEnergy"] | unitvalue:'kWh' }}
</td>
</tr>
</ng-container>
</ng-container>
</ng-container>
<tr *ngIf="evcsComponents.length != 0 || consumptionMeterComponents.length != 0">
<tr
*ngIf="(evcsComponents.length != 0 || consumptionMeterComponents.length != 0) && totalOtherEnergy > 0">
<td style="width:65%" translate>General.otherConsumption</td>
<ng-container
*ngIf="data['_sum/ConsumptionActiveEnergy'] - getTotalOtherEnergy() as totalOtherEnergy">

<td style="width:35%" class="align_right">
{{ totalOtherEnergy | unitvalue:'kWh' }}
</td>
</ng-container>
<td style="width:35%" class="align_right">
{{ totalOtherEnergy | unitvalue:'kWh' }}
</td>
</tr>
</ng-container>

Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/edge/history/consumption/widget.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class ConsumptionComponent extends AbstractHistoryWidget implements OnIni
otherEnergy += this.data[component.id + '/EnergyTotal'];
})
this.consumptionMeterComponents.forEach(component => {
otherEnergy += this.data[component.id + '/ActiveConsumptionEnergy'];
otherEnergy += this.data[component.id + '/ActiveProductionEnergy'];
})
this.totalOtherEnergy = response.result.data["_sum/ConsumptionActiveEnergy"] - otherEnergy;
}).catch(() => {
Expand All @@ -80,7 +80,7 @@ export class ConsumptionComponent extends AbstractHistoryWidget implements OnIni
this.consumptionMeterComponents = config.getComponentsImplementingNature("io.openems.edge.meter.api.SymmetricMeter").filter(component => component.properties['type'] == 'CONSUMPTION_METERED');
for (let component of this.consumptionMeterComponents) {
channels.push(
new ChannelAddress(component.id, 'ActiveConsumptionEnergy'),
new ChannelAddress(component.id, 'ActiveProductionEnergy'),
)
}
resolve(channels);
Expand Down

0 comments on commit 7e9a9e1

Please sign in to comment.