renamed battery total to charge and added total temp
This commit is contained in:
parent
302765b5fe
commit
46e78379d8
@ -1,7 +1,7 @@
|
||||
<div class="p-3">
|
||||
<div class="d-flex mb-3">
|
||||
<div class="d-flex flex-grow-1 align-items-center">
|
||||
<h3 class="mb-0 text-white">Powerwall: {{batteryService.total | round}} V</h3>
|
||||
<h3 class="mb-0 text-white">Powerwall: {{batteryService.charge | round}} V</h3>
|
||||
</div>
|
||||
<div class="d-flex flex-grow-1 align-content-center justify-content-end">
|
||||
<mat-button-toggle-group [(ngModel)]="batteryService.relayMode" (change)="batteryService.setRelayMode($event.value)">
|
||||
|
@ -8,9 +8,10 @@ export class BatteryService {
|
||||
readonly firestore;
|
||||
|
||||
batteries = [];
|
||||
charge: number = 0;
|
||||
last: Date;
|
||||
relayMode?: boolean = null;
|
||||
total: number = 0;
|
||||
temp: number = 0;
|
||||
|
||||
get icon() {
|
||||
if (!this.batteries.length) return 'battery_alert';
|
||||
@ -61,7 +62,8 @@ export class BatteryService {
|
||||
tempHistory: data.modules[key].map((val, i) => ({name: i, value: val.temp}))
|
||||
}
|
||||
});
|
||||
this.total = this.batteries.reduce((acc, battery) => acc + battery.charge, 0) / 2;
|
||||
this.charge = this.batteries.reduce((acc, battery) => acc + battery.charge, 0) / 2;
|
||||
this.temp = this.batteries.reduce((acc, battery) => acc + battery.temp, 0) / 4;
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user