mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-20 02:38:53 +00:00
Fix energy dashboard redirect for device-consumption-only configs (#28322)
When users configure energy with only device consumption (no grid/solar/battery/gas/water sources), the dashboard would redirect to /config/energy instead of displaying. This occurred because _generateLovelaceConfig() returned an empty views array. The fix adds hasDeviceConsumption check and includes ENERGY_VIEW when device consumption is configured, since energy-view-strategy already supports device consumption cards.
This commit is contained in:
@@ -268,8 +268,10 @@ class PanelEnergy extends LitElement {
|
|||||||
(source) => source.type === "gas"
|
(source) => source.type === "gas"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const hasDeviceConsumption = this._prefs.device_consumption.length > 0;
|
||||||
|
|
||||||
const views: LovelaceViewConfig[] = [];
|
const views: LovelaceViewConfig[] = [];
|
||||||
if (hasEnergy) {
|
if (hasEnergy || hasDeviceConsumption) {
|
||||||
views.push(ENERGY_VIEW);
|
views.push(ENERGY_VIEW);
|
||||||
}
|
}
|
||||||
if (hasGas) {
|
if (hasGas) {
|
||||||
|
|||||||
Reference in New Issue
Block a user