From 46e78379d89428d9d282ea5fe120ede904b2124a Mon Sep 17 00:00:00 2001 From: Zak Timson Date: Tue, 1 Jan 2019 19:24:57 -0500 Subject: [PATCH] renamed battery total to charge and added total temp --- src/app/battery/battery.component.html | 2 +- src/app/battery/battery.service.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/battery/battery.component.html b/src/app/battery/battery.component.html index 3861e5c..a956ac2 100644 --- a/src/app/battery/battery.component.html +++ b/src/app/battery/battery.component.html @@ -1,7 +1,7 @@
-

Powerwall: {{batteryService.total | round}} V

+

Powerwall: {{batteryService.charge | round}} V

diff --git a/src/app/battery/battery.service.ts b/src/app/battery/battery.service.ts index 2c16c4f..341c38e 100644 --- a/src/app/battery/battery.service.ts +++ b/src/app/battery/battery.service.ts @@ -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; }); }