From a475b06d49af41c4dfc98e781e5e67b2ec136c05 Mon Sep 17 00:00:00 2001 From: Josh McCarty Date: Mon, 17 Oct 2022 02:15:37 -0700 Subject: [PATCH] Format entity & sensor card with manual units; fix param comment typo (#14090) --- src/common/number/format_number.ts | 2 +- src/panels/lovelace/cards/hui-entity-card.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/number/format_number.ts b/src/common/number/format_number.ts index 9c4d9e24ce..5b9c1bb1b4 100644 --- a/src/common/number/format_number.ts +++ b/src/common/number/format_number.ts @@ -34,7 +34,7 @@ export const numberFormatToLocale = ( * Formats a number based on the user's preference with thousands separator(s) and decimal character for better legibility. * * @param num The number to format - * @param locale The user-selected language and number format, from `hass.locale` + * @param localeOptions The user-selected language and formatting, from `hass.locale` * @param options Intl.NumberFormatOptions to use */ export const formatNumber = ( diff --git a/src/panels/lovelace/cards/hui-entity-card.ts b/src/panels/lovelace/cards/hui-entity-card.ts index 95c1916bff..5defde0d93 100644 --- a/src/panels/lovelace/cards/hui-entity-card.ts +++ b/src/panels/lovelace/cards/hui-entity-card.ts @@ -146,7 +146,7 @@ export class HuiEntityCard extends LitElement implements LovelaceCard { stateObj.attributes[this._config.attribute!] ) : this.hass.localize("state.default.unknown") - : isNumericState(stateObj) + : isNumericState(stateObj) || this._config.unit ? formatNumber(stateObj.state, this.hass.locale) : computeStateDisplay( this.hass.localize,