diff --git a/src/panels/lovelace/cards/hui-statistics-graph-card.ts b/src/panels/lovelace/cards/hui-statistics-graph-card.ts index 47f737927a..73fe66c3e2 100644 --- a/src/panels/lovelace/cards/hui-statistics-graph-card.ts +++ b/src/panels/lovelace/cards/hui-statistics-graph-card.ts @@ -58,7 +58,7 @@ export class HuiStatisticsGraphCard extends LitElement implements LovelaceCard { clearInterval(this._interval); this._interval = window.setInterval( () => this._getStatistics(), - 1000 * 60 * 60 + this._intervalTimeout ); } @@ -126,7 +126,7 @@ export class HuiStatisticsGraphCard extends LitElement implements LovelaceCard { clearInterval(this._interval); this._interval = window.setInterval( () => this._getStatistics(), - 1000 * 60 * 60 + this._intervalTimeout ); } } @@ -156,6 +156,10 @@ export class HuiStatisticsGraphCard extends LitElement implements LovelaceCard { `; } + private get _intervalTimeout(): number { + return (this._config?.period === "5minute" ? 5 : 60) * 1000 * 60; + } + private async _getStatistics(): Promise { const startDate = new Date(); startDate.setTime(