Skip to content

Commit

Permalink
Honor entity ordering in statistics graph card (#16504)
Browse files Browse the repository at this point in the history
  • Loading branch information
karwosts committed May 11, 2023
1 parent 4505657 commit ae8eafe
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/panels/lovelace/cards/hui-statistics-graph-card.ts
Expand Up @@ -251,7 +251,7 @@ export class HuiStatisticsGraphCard extends LitElement implements LovelaceCard {
: undefined;
}
const unitconfig = unitClass ? { [unitClass]: this._unit } : undefined;
this._statistics = await fetchStatistics(
const statistics = await fetchStatistics(
this.hass!,
startDate,
undefined,
Expand All @@ -260,6 +260,13 @@ export class HuiStatisticsGraphCard extends LitElement implements LovelaceCard {
unitconfig,
this._statTypes
);

this._statistics = {};
this._entities.forEach((id) => {
if (id in statistics) {
this._statistics![id] = statistics[id];
}
});
} catch (err) {
this._statistics = undefined;
}
Expand Down

0 comments on commit ae8eafe

Please sign in to comment.