mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 08:16:36 +00:00
Fix a bug in energy batteryToGrid calculation (#19958)
This commit is contained in:
parent
50da4bcd37
commit
5523cd6203
@ -177,7 +177,7 @@ class HuiEnergyDistrubutionCard
|
||||
if (hasBattery) {
|
||||
batteryFromGrid = solarConsumption * -1;
|
||||
if (batteryFromGrid > totalFromGrid) {
|
||||
batteryToGrid = Math.min(0, batteryFromGrid - totalFromGrid);
|
||||
batteryToGrid = batteryFromGrid - totalFromGrid;
|
||||
batteryFromGrid = totalFromGrid;
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ class HuiEnergySelfSufficiencyGaugeCard
|
||||
if (hasBattery) {
|
||||
batteryFromGrid = solarConsumption * -1;
|
||||
if (batteryFromGrid > totalFromGrid) {
|
||||
batteryToGrid = Math.min(0, batteryFromGrid - totalFromGrid);
|
||||
batteryToGrid = batteryFromGrid - totalFromGrid;
|
||||
batteryFromGrid = totalFromGrid;
|
||||
}
|
||||
}
|
||||
|
@ -434,10 +434,8 @@ export class HuiEnergyUsageGraphCard
|
||||
if (summedData.to_battery) {
|
||||
grid_to_battery[start] = used_solar[start] * -1;
|
||||
if (grid_to_battery[start] > (summedData.from_grid?.[start] || 0)) {
|
||||
battery_to_grid[start] = Math.min(
|
||||
0,
|
||||
grid_to_battery[start] - (summedData.from_grid?.[start] || 0)
|
||||
);
|
||||
battery_to_grid[start] =
|
||||
grid_to_battery[start] - (summedData.from_grid?.[start] || 0);
|
||||
grid_to_battery[start] = summedData.from_grid?.[start];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user