From 9001cd3e65fe0e0f259021babe6ee8cc9e7ca2f6 Mon Sep 17 00:00:00 2001 From: Petar Petrov Date: Wed, 26 Nov 2025 18:37:18 +0200 Subject: [PATCH] Replace gauges with energy usage graph in energy overview (#28150) --- .../energy-overview-view-strategy.ts | 44 ++----------------- 1 file changed, 3 insertions(+), 41 deletions(-) diff --git a/src/panels/energy/strategies/energy-overview-view-strategy.ts b/src/panels/energy/strategies/energy-overview-view-strategy.ts index 3ed415fb84..698c25c6fb 100644 --- a/src/panels/energy/strategies/energy-overview-view-strategy.ts +++ b/src/panels/energy/strategies/energy-overview-view-strategy.ts @@ -6,7 +6,6 @@ import type { HomeAssistant } from "../../../types"; import type { LovelaceViewConfig } from "../../../data/lovelace/config/view"; import type { LovelaceStrategyConfig } from "../../../data/lovelace/config/strategy"; import type { LovelaceSectionConfig } from "../../../data/lovelace/config/section"; -import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; import { DEFAULT_ENERGY_COLLECTION_KEY } from "../ha-panel-energy"; const sourceHasCost = (source: Record): boolean => @@ -52,10 +51,6 @@ export class EnergyViewStrategy extends ReactiveElement { source.type === "grid" && (source.flow_from?.length || source.flow_to?.length) ) as GridSourceTypeEnergyPreference; - const hasReturn = hasGrid && hasGrid.flow_to.length > 0; - const hasSolar = prefs.energy_sources.some( - (source) => source.type === "solar" - ); const hasGas = prefs.energy_sources.some((source) => source.type === "gas"); const hasBattery = prefs.energy_sources.some( (source) => source.type === "battery" @@ -143,43 +138,10 @@ export class EnergyViewStrategy extends ReactiveElement { modes: ["bar"], }); } else if (hasGrid) { - const gauges: LovelaceCardConfig[] = []; - // Only include if we have a grid source & return. - if (hasReturn) { - gauges.push({ - type: "energy-grid-neutrality-gauge", - view_layout: { position: "sidebar" }, - collection_key: collectionKey, - }); - } - - gauges.push({ - type: "energy-carbon-consumed-gauge", - view_layout: { position: "sidebar" }, - collection_key: collectionKey, - }); - - // Only include if we have a solar source. - if (hasSolar) { - if (hasReturn) { - gauges.push({ - type: "energy-solar-consumed-gauge", - view_layout: { position: "sidebar" }, - collection_key: collectionKey, - }); - } - gauges.push({ - type: "energy-self-sufficiency-gauge", - view_layout: { position: "sidebar" }, - collection_key: collectionKey, - }); - } - electricitySection.cards!.push({ - type: "grid", - columns: 2, - square: false, - cards: gauges, + title: hass.localize("ui.panel.energy.cards.energy_usage_graph_title"), + type: "energy-usage-graph", + collection_key: collectionKey, }); }