thowie
19. Juli 2026 um 22:13
114
Ich hab meinem Home Assistant gerade das Update von 2026.6.4 auf 2026.7.2 angetan und angetan trifft es wohl perfekt.
Ja, es läuft soweit ich das bisher sehen, aber das Energy Dashboard hat es dieses mal erneut getroffen.
Wenn man keinen Speicher konfiguriert hat wird der PV Ertrag oberhalb des Netzbezugs dargestellt, statt unterhalb.
Ich habe dazu gerade auch eine Frontend Issue erstellt.
offen 10:02PM - 19 Jul 26 UTC
### Checklist
- [x] I have updated to the latest available Home Assistant versi… on.
- [x] I have cleared the cache of my browser.
- [x] I have tried a different browser to see if it is related to my browser.
- [x] I have tried reproducing the issue in [safe mode](https://www.home-assistant.io/blog/2023/11/01/release-202311/#restarting-into-safe-mode) to rule out problems with unsupported custom resources.
### Describe the issue you are experiencing
After upgrading from Home Assistant 2026.6.x to 2026.7.x, the stacking order in the default Energy Dashboard's "Electricity usage" graph changed for installations that have grid import and solar production configured, but no battery source configured in the Energy Dashboard.
"Consumed solar" is now drawn above "Consumed from grid".
Before 2026.7, consumed solar was at the bottom of the positive stack and grid consumption was stacked above it. This made it possible to compare solar self-consumption directly across the displayed periods.
This appears to be a regression introduced by frontend pull request #52541:
https://github.com/home-assistant/frontend/pull/52541
The pull request added the following explicit stack order:
const stackOrder = {
to_battery: 1,
to_grid: 2,
used_solar: 3,
used_battery: 4,
};
However, there is no explicit order for from_grid or used_grid. Those types use this fallback:
order: stackOrder[type] ?? Object.keys(combinedData).length
In an Energy Dashboard configuration with grid and solar but without a configured battery source, this causes the grid-consumption dataset to be sorted before, or with the same order as, used_solar. As a result, consumed solar is stacked on top of grid consumption.
This also recreates the presentation that was previously reported and fixed in these issues:
https://github.com/home-assistant/frontend/issues/24131
https://github.com/home-assistant/frontend/issues/24276
### Describe the behavior you expected
For an Energy Dashboard with grid consumption and solar production, but without a configured battery source, consumed solar should remain at the bottom of the positive stack and grid consumption should be stacked above it.
The positive stack should therefore be displayed as:
Top: Consumed from grid
Bottom: Consumed solar
This was the behavior before Home Assistant 2026.7 and the behavior previously restored by the fixes for #24131 and #24276.
from_grid and used_grid should receive an explicit stack order so that the result does not depend on the number or insertion order of the available datasets.
### Steps to reproduce the issue
1. Configure grid consumption in the default Energy Dashboard.
2. Configure solar production in the default Energy Dashboard.
3. Do not configure a battery source under "Battery systems".
4. Select a period containing both solar self-consumption and grid consumption.
5. Open the default Energy Dashboard.
6. Look at the "Electricity usage" graph.
7. Observe that "Consumed solar" is stacked above "Consumed from grid".
8. Compare this with the stacking order before Home Assistant 2026.7 or with the expected result documented in #24131.
### What version of Home Assistant Core has the issue?
core-2026.7.2
### What was the last working version of Home Assistant Core?
core-2026.6.4
### In which browser are you experiencing the issue?
Google Chrome 149.0.0.0 (64-bit)
### Which operating system are you using to run this browser?
Windows 11 Pro 25H2
### State of relevant entities
```txt
Not applicable.
The energy values themselves are correct. Only the visual stacking order of the datasets in the default Energy Dashboard is wrong.
```
### Problem-relevant frontend configuration
```yaml
Default Home Assistant Energy Dashboard.
Configured energy sources:
Grid consumption: configured
Return to grid: configured
Solar production: configured
Battery systems: none configured
No custom card is involved. The problem occurs in the built-in Energy Dashboard.
```
### JavaScript errors shown in your browser console/inspector
```txt
No relevant JavaScript errors are shown.
```
### Additional information
Regression introduced by:
https://github.com/home-assistant/frontend/pull/52541
Relevant previous issues:
https://github.com/home-assistant/frontend/issues/24131
https://github.com/home-assistant/frontend/issues/24276
The current implementation defines explicit orders for to_battery, to_grid, used_solar, and used_battery, but not for from_grid or used_grid.
Because the missing types use Object.keys(combinedData).length as their fallback order, the resulting stack order changes depending on whether battery datasets are present.
I was able to confirm that the regression is caused by the frontend dataset ordering.
As a temporary local diagnostic workaround, I loaded an additional frontend module that wraps _processDataSet() and changes only the Chart.js order value of the used_solar dataset:
```
const originalProcessDataSet = prototype._processDataSet;
prototype._processDataSet = function (...args) {
const datasets = originalProcessDataSet.apply(this, args);
for (const dataset of datasets) {
const id = String(dataset.id ?? "");
if (id.endsWith("-used_solar")) {
dataset.order = 1;
}
}
return datasets;
};
```
No energy entities, statistics, recorder data, or Energy Dashboard configuration are changed by this workaround.
After reloading the frontend with this single change, consumed solar is immediately displayed at the bottom of the positive stack again, with grid consumption above it, matching the behavior before Home Assistant 2026.7.
Disabling the module and reloading the frontend immediately reproduces the incorrect stacking order.
This strongly indicates that the regression is caused by the dataset ordering introduced in #52541 rather than by the underlying energy data or configuration.
Screenshots attached:
1. Electricity usage graph without the workaround: consumed solar is stacked above grid consumption:
<img width="2312" height="1434" alt="Image" src="https://github.com/user-attachments/assets/eb15616e-2f59-4104-8637-1fedd5225b98" />
2. Electricity usage graph with the workaround: consumed solar is stacked below grid consumption.
<img width="2312" height="1458" alt="Image" src="https://github.com/user-attachments/assets/35da1a48-1f1e-4856-a85f-a32516207f31" />
3. Energy Dashboard configuration showing that no battery system is configured.
<img width="2310" height="1139" alt="Image" src="https://github.com/user-attachments/assets/47f9f78a-30c7-4ac2-938f-3784ad755507" />
FĂĽr mein System habe ich darĂĽber hinaus einen lokalen Workaround implementiert.
Wer das gleiche Problem hat und es direkt gelöst haben möchte kann das wie folgt tun:
In der Configuration.yaml den frontend Abschnitt wie folgt erweitern:
frontend:
themes: !include_dir_merge_named themes
extra_module_url:
- /local/energy-stack-order-fix.js?v=1
die dort referenzierte Datei:
/local/energy-stack-order-fix.js
mit folgendem Inhalt anlegen:
const cardTagName = "hui-energy-usage-graph-card";
customElements.whenDefined(cardTagName).then(() => {
const cardClass = customElements.get(cardTagName);
const prototype = cardClass?.prototype;
if (!prototype || prototype.__oldEnergyStackOrderApplied) {
return;
}
const originalProcessDataSet = prototype._processDataSet;
if (typeof originalProcessDataSet !== "function") {
console.error(
"[energy-stack-order-fix] _processDataSet wurde nicht gefunden."
);
return;
}
prototype._processDataSet = function (...args) {
const datasets = originalProcessDataSet.apply(this, args);
for (const dataset of datasets) {
const id = String(dataset.id ?? "");
/*
* Verhalten vor Home Assistant 2026.7:
* PV-Eigenverbrauch liegt am unteren Ende des positiven Stapels.
*/
if (id.endsWith("-used_solar")) {
dataset.order = 1;
}
}
return datasets;
};
Object.defineProperty(prototype, "__oldEnergyStackOrderApplied", {
value: true,
configurable: false,
enumerable: false,
writable: false,
});
console.info("[energy-stack-order-fix] Alte PV-Stapelreihenfolge aktiviert.");
});
Home Assistant neu starten
Browser Cache löschen mit: Strg + F5
AnschlieĂźend sollten die Balken wieder wie gewohnt gestapelt sein.