From 162376bd9ade661e0094223f911b38a57772c528 Mon Sep 17 00:00:00 2001 From: ulic75 Date: Tue, 10 May 2022 08:41:36 -0600 Subject: [PATCH] fix: prevent negative solar state (#25) closes #23 --- src/power-flow-card.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/power-flow-card.ts b/src/power-flow-card.ts index 137349b8..2ad3dc70 100644 --- a/src/power-flow-card.ts +++ b/src/power-flow-card.ts @@ -89,7 +89,7 @@ export class PowerFlowCard extends LitElement { const batteryChargeState = entities.battery_charge?.length ? this.getEntityState(entities.battery_charge) : null; - const solarState = this.getEntityStateWatts(entities.solar); + const solarState = Math.max(this.getEntityStateWatts(entities.solar), 0); const solarToGrid = hasReturnToGrid ? typeof entities.grid === "string"