From a884be56910b70c43e210c01ec692fa34cd2d6f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20F=C3=A9lix?= Date: Sat, 27 May 2023 10:41:01 +0200 Subject: [PATCH] fix: card showing loading when no date selection --- src/energy-flow-card-plus.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/energy-flow-card-plus.ts b/src/energy-flow-card-plus.ts index da8790f..5e93bd5 100644 --- a/src/energy-flow-card-plus.ts +++ b/src/energy-flow-card-plus.ts @@ -291,7 +291,7 @@ export default class EnergyFlowCardPlus extends SubscribeMixin(LitElement) { return html``; } - if (!this._data) { + if (!this._data && this._config.energy_date_selection !== false) { return html`${this.hass.localize('ui.panel.lovelace.cards.energy.loading')}`; } @@ -891,7 +891,7 @@ export default class EnergyFlowCardPlus extends SubscribeMixin(LitElement) { : this.displayValue(totalHomeConsumption); let lowCarbonPercentage: number | undefined; - if (this._data.co2SignalEntity && this._data.fossilEnergyConsumption) { + if (this._data && this._data.co2SignalEntity && this._data.fossilEnergyConsumption) { // Calculate high carbon consumption const highCarbonEnergy = Object.values(this._data.fossilEnergyConsumption).reduce((sum, a) => sum + a, 0) * 1000;