mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-22 16:56:35 +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) {
|
if (hasBattery) {
|
||||||
batteryFromGrid = solarConsumption * -1;
|
batteryFromGrid = solarConsumption * -1;
|
||||||
if (batteryFromGrid > totalFromGrid) {
|
if (batteryFromGrid > totalFromGrid) {
|
||||||
batteryToGrid = Math.min(0, batteryFromGrid - totalFromGrid);
|
batteryToGrid = batteryFromGrid - totalFromGrid;
|
||||||
batteryFromGrid = totalFromGrid;
|
batteryFromGrid = totalFromGrid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ class HuiEnergySelfSufficiencyGaugeCard
|
|||||||
if (hasBattery) {
|
if (hasBattery) {
|
||||||
batteryFromGrid = solarConsumption * -1;
|
batteryFromGrid = solarConsumption * -1;
|
||||||
if (batteryFromGrid > totalFromGrid) {
|
if (batteryFromGrid > totalFromGrid) {
|
||||||
batteryToGrid = Math.min(0, batteryFromGrid - totalFromGrid);
|
batteryToGrid = batteryFromGrid - totalFromGrid;
|
||||||
batteryFromGrid = totalFromGrid;
|
batteryFromGrid = totalFromGrid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -434,10 +434,8 @@ export class HuiEnergyUsageGraphCard
|
|||||||
if (summedData.to_battery) {
|
if (summedData.to_battery) {
|
||||||
grid_to_battery[start] = used_solar[start] * -1;
|
grid_to_battery[start] = used_solar[start] * -1;
|
||||||
if (grid_to_battery[start] > (summedData.from_grid?.[start] || 0)) {
|
if (grid_to_battery[start] > (summedData.from_grid?.[start] || 0)) {
|
||||||
battery_to_grid[start] = Math.min(
|
battery_to_grid[start] =
|
||||||
0,
|
grid_to_battery[start] - (summedData.from_grid?.[start] || 0);
|
||||||
grid_to_battery[start] - (summedData.from_grid?.[start] || 0)
|
|
||||||
);
|
|
||||||
grid_to_battery[start] = summedData.from_grid?.[start];
|
grid_to_battery[start] = summedData.from_grid?.[start];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user