diff --git a/src/ha-elec-sankey.ts b/src/ha-elec-sankey.ts index b7faebd..66fb209 100644 --- a/src/ha-elec-sankey.ts +++ b/src/ha-elec-sankey.ts @@ -39,6 +39,7 @@ export class HaElecSankey extends ElecSankey { valueB: number | undefined ): TemplateResult { const _id = id || ""; + const numFractionDigits = this.unit === "kWh" ? 1 : 0; return html`
${formatNumber(valueB, this.hass.locale, { - maximumFractionDigits: 0, + maximumFractionDigits: numFractionDigits, })} ${this.unit}
${formatNumber(valueA, this.hass.locale, { - maximumFractionDigits: 0, + maximumFractionDigits: numFractionDigits, })} ${this.unit} ` : html`
${formatNumber(valueA, this.hass.locale, { - maximumFractionDigits: 0, + maximumFractionDigits: numFractionDigits, })} ${this.unit}`}
`; }