change interval if 5 min stats
This commit is contained in:
parent
71c43058ea
commit
da38cbccf1
|
@ -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<void> {
|
||||
const startDate = new Date();
|
||||
startDate.setTime(
|
||||
|
|
Loading…
Reference in New Issue