mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-14 12:56:37 +00:00
If we have solar defined, always make sure sum is number so it shows placeholders (#9634)
This commit is contained in:
parent
9c31b749d7
commit
f87d4a5ab6
@ -86,19 +86,21 @@ class HuiEnergyDistrubutionCard extends LitElement implements LovelaceCard {
|
|||||||
let totalSolarProduction: number | null = null;
|
let totalSolarProduction: number | null = null;
|
||||||
|
|
||||||
if (hasSolarProduction) {
|
if (hasSolarProduction) {
|
||||||
totalSolarProduction = calculateStatisticsSumGrowth(
|
totalSolarProduction =
|
||||||
|
calculateStatisticsSumGrowth(
|
||||||
this._stats,
|
this._stats,
|
||||||
types.solar!.map((source) => source.stat_energy_from)
|
types.solar!.map((source) => source.stat_energy_from)
|
||||||
);
|
) || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let productionReturnedToGrid: number | null = null;
|
let productionReturnedToGrid: number | null = null;
|
||||||
|
|
||||||
if (hasReturnToGrid) {
|
if (hasReturnToGrid) {
|
||||||
productionReturnedToGrid = calculateStatisticsSumGrowth(
|
productionReturnedToGrid =
|
||||||
|
calculateStatisticsSumGrowth(
|
||||||
this._stats,
|
this._stats,
|
||||||
types.grid![0].flow_to.map((flow) => flow.stat_energy_to)
|
types.grid![0].flow_to.map((flow) => flow.stat_energy_to)
|
||||||
);
|
) || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const totalConsumption =
|
const totalConsumption =
|
||||||
@ -191,7 +193,7 @@ class HuiEnergyDistrubutionCard extends LitElement implements LovelaceCard {
|
|||||||
: ""}${round(totalGridConsumption, 1)}
|
: ""}${round(totalGridConsumption, 1)}
|
||||||
kWh
|
kWh
|
||||||
</span>
|
</span>
|
||||||
${productionReturnedToGrid
|
${productionReturnedToGrid !== null
|
||||||
? html`<span class="return">
|
? html`<span class="return">
|
||||||
<ha-svg-icon
|
<ha-svg-icon
|
||||||
class="small"
|
class="small"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user