diff --git a/src/panels/energy/strategies/energy-electricity-view-strategy.ts b/src/panels/energy/strategies/energy-electricity-view-strategy.ts index 3e3139610cf6..382841df3b10 100644 --- a/src/panels/energy/strategies/energy-electricity-view-strategy.ts +++ b/src/panels/energy/strategies/energy-electricity-view-strategy.ts @@ -46,12 +46,39 @@ export class EnergyElectricityViewStrategy extends ReactiveElement { const hasBattery = prefs.energy_sources.some( (source) => source.type === "battery" ); + const hasPowerSources = prefs.energy_sources.find( + (source) => + (source.type === "solar" && source.stat_rate) || + (source.type === "battery" && source.stat_rate) || + (source.type === "grid" && source.power?.length) + ); + const hasPowerDevices = prefs.device_consumption.find( + (device) => device.stat_rate + ); view.cards!.push({ type: "energy-compare", collection_key: "energy_dashboard", }); + if (hasPowerSources) { + if (hasPowerDevices) { + view.cards!.push({ + title: hass.localize("ui.panel.energy.cards.power_sankey_title"), + type: "power-sankey", + collection_key: collectionKey, + grid_options: { + columns: 24, + }, + }); + } + view.cards!.push({ + title: hass.localize("ui.panel.energy.cards.power_sources_graph_title"), + type: "power-sources-graph", + collection_key: collectionKey, + }); + } + // Only include if we have a grid or battery. if (hasGrid || hasBattery) { view.cards!.push({ diff --git a/src/translations/en.json b/src/translations/en.json index 9cf0b25b651b..f467b57e5b43 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -9470,7 +9470,8 @@ "energy_devices_detail_graph_title": "Individual devices detail usage", "energy_sankey_title": "Energy flow", "energy_top_consumers_title": "Top consumers", - "power_sankey_title": "Current power flow" + "power_sankey_title": "Current power flow", + "power_sources_graph_title": "Power sources" } }, "history": {