diff --git a/src/cards/number-card/number-card.ts b/src/cards/number-card/number-card.ts index 4b1c158e..f223f7a6 100644 --- a/src/cards/number-card/number-card.ts +++ b/src/cards/number-card/number-card.ts @@ -14,9 +14,6 @@ import { actionHandler, ActionHandlerEvent, computeRTL, - formatNumber, - getDefaultFormatOptions, - getNumberFormatOptions, handleAction, hasAction, HomeAssistant, @@ -125,15 +122,10 @@ export class NumberCard let stateDisplay = this.hass.formatEntityState(stateObj); if (this.value !== undefined) { - const numberValue = formatNumber( - this.value, - this.hass.locale, - getNumberFormatOptions( - stateObj, - this.hass.entities[stateObj.entity_id] - ) ?? getDefaultFormatOptions(stateObj.state) + stateDisplay = this.hass.formatEntityState( + stateObj, + this.value.toString() ); - stateDisplay = `${numberValue} ${stateObj.attributes.unit_of_measurement ?? ""}`; } const rtl = computeRTL(this.hass); diff --git a/src/shared/input-number.ts b/src/shared/input-number.ts index baa7eca1..8bfd9bd6 100644 --- a/src/shared/input-number.ts +++ b/src/shared/input-number.ts @@ -45,7 +45,7 @@ export class InputNumber extends LitElement { @property({ type: Number }) public max?: number; - @property({ attribute: "false" }) + @property({ attribute: false }) public formatOptions: Intl.NumberFormatOptions = {}; @state() pending = false;