diff --git a/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts index ea787919ff..a06032701b 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts @@ -278,6 +278,8 @@ export class HuiEnergyDevicesGraphCard chartData.sort((a, b) => b.x - a.x); + chartData.length = this._config?.max_devices || chartData.length; + chartData.forEach((d: any) => { const color = getColorByIndex(d.idx); diff --git a/src/panels/lovelace/cards/types.ts b/src/panels/lovelace/cards/types.ts index 7ddeef08a3..d1aae33408 100644 --- a/src/panels/lovelace/cards/types.ts +++ b/src/panels/lovelace/cards/types.ts @@ -153,6 +153,7 @@ export interface EnergyDevicesGraphCardConfig extends LovelaceCardConfig { type: "energy-devices-graph"; title?: string; collection_key?: string; + max_devices?: number; } export interface EnergySourcesTableCardConfig extends LovelaceCardConfig {