mirror of
https://github.com/home-assistant/frontend.git
synced 2026-02-15 07:25:54 +00:00
Don't set history redraw timer when not connected (#28679)
This commit is contained in:
@@ -135,6 +135,10 @@ export class HuiHistoryGraphCard extends LitElement implements LovelaceCard {
|
||||
const { numeric_device_classes: sensorNumericDeviceClasses } =
|
||||
await getSensorNumericDeviceClasses(this.hass!);
|
||||
|
||||
if (!this.isConnected) {
|
||||
return; // Skip subscribe if we already disconnected while awaiting
|
||||
}
|
||||
|
||||
this._subscribed = subscribeHistoryStatesTimeWindow(
|
||||
this.hass!,
|
||||
(combinedHistory) => {
|
||||
@@ -212,7 +216,9 @@ export class HuiHistoryGraphCard extends LitElement implements LovelaceCard {
|
||||
private _setRedrawTimer() {
|
||||
// redraw the graph every minute to update the time axis
|
||||
clearInterval(this._interval);
|
||||
this._interval = window.setInterval(() => this._redrawGraph(), 1000 * 60);
|
||||
if (this.isConnected) {
|
||||
this._interval = window.setInterval(() => this._redrawGraph(), 1000 * 60);
|
||||
}
|
||||
}
|
||||
|
||||
private _unsubscribeHistory() {
|
||||
|
||||
Reference in New Issue
Block a user