Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/power-flow-card-plus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,17 @@ export class PowerFlowCardPlus extends LitElement {
}
}
solar.state.toHome = 0;
} else if (solar.state.toHome !== null && solar.state.toHome > 0) {
} else if (battery.state.toBattery !== null && battery.state.toBattery > 0) {
// Battery is being charged, but by what (grid or solar) and by how much?
// Solar is charging battery with any power left over after powering the
// home and sending to grid
solar.state.toBattery = solar.state.total - (solar.state.toHome || 0) - (grid.state.toGrid || 0);

// Grid is providing any left over battery charging power after
// compensating for the solar charging
grid.state.toBattery = battery.state.toBattery - solar.state.toBattery;
} else {
grid.state.toBattery = 0;
} else if (battery.state.toBattery && battery.state.toBattery > 0) {
grid.state.toBattery = battery.state.toBattery;
}
grid.state.toBattery = (grid.state.toBattery ?? 0) > largestGridBatteryTolerance ? grid.state.toBattery : 0;

Expand Down