Skip to content

Commit d7f6f2f

Browse files
authored
Restore consumption formatting in energy distribution card
1 parent b5ea004 commit d7f6f2f

1 file changed

Lines changed: 5 additions & 27 deletions

File tree

src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -161,25 +161,6 @@ class HuiEnergyDistrubutionCard
161161
const hasSolarProduction = types.solar !== undefined;
162162
const hasBattery = types.battery !== undefined;
163163
const hasGas = types.gas !== undefined;
164-
165-
const gasDisplayPrecisions = types.gas
166-
?.map(
167-
(source) =>
168-
this.hass.entities[source.stat_energy_from]?.display_precision
169-
)
170-
.filter((precision): precision is number => precision !== undefined);
171-
172-
const gasDisplayPrecision = gasDisplayPrecisions?.length
173-
? Math.max(...gasDisplayPrecisions)
174-
: undefined;
175-
176-
const gasFormatOptions =
177-
gasDisplayPrecision !== undefined
178-
? {
179-
minimumFractionDigits: gasDisplayPrecision,
180-
maximumFractionDigits: gasDisplayPrecision,
181-
}
182-
: undefined;
183164
const hasWater = types.water !== undefined;
184165
const hasReturnToGrid =
185166
types.grid?.some((source) => source.stat_energy_to) ?? false;
@@ -453,14 +434,11 @@ class HuiEnergyDistrubutionCard
453434
>
454435
<div class="circle">
455436
<ha-svg-icon .path=${mdiFire}></ha-svg-icon>
456-
457-
${gasUsage === null
458-
? ""
459-
: `${formatNumber(
460-
gasUsage,
461-
this.hass.locale,
462-
gasFormatOptions
463-
)} ${this._data.gasUnit}`}
437+
${formatConsumptionShort(
438+
this.hass,
439+
gasUsage,
440+
this._data.gasUnit
441+
)}
464442
</div>
465443
<svg width="80" height="30">
466444
<path d="M40 0 v30" id="gas" />

0 commit comments

Comments
 (0)