diff --git a/src/panels/lovelace/entity-rows/hui-select-entity-row.ts b/src/panels/lovelace/entity-rows/hui-select-entity-row.ts index a169cbe565..d11f473aa4 100644 --- a/src/panels/lovelace/entity-rows/hui-select-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-select-entity-row.ts @@ -9,6 +9,7 @@ import { } from "lit"; import { customElement, property, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; +import { computeStateDisplay } from "../../../common/entity/compute_state_display"; import { computeStateName } from "../../../common/entity/compute_state_name"; import "../../../components/ha-select"; import { UNAVAILABLE } from "../../../data/entity"; @@ -76,15 +77,14 @@ class HuiSelectEntityRow extends LitElement implements LovelaceRow { ? stateObj.attributes.options.map( (option) => html` - ${(stateObj.attributes.device_class && - this.hass!.localize( - `component.select.state.${stateObj.attributes.device_class}.${option}` - )) || - this.hass!.localize( - `component.select.state._.${option}` - ) || - option} + + ${computeStateDisplay( + this.hass!.localize, + stateObj, + this.hass!.locale, + this.hass!.entities, + option + )} ` ) diff --git a/src/state-summary/state-card-select.ts b/src/state-summary/state-card-select.ts index a37c8e07ad..78c749c48e 100644 --- a/src/state-summary/state-card-select.ts +++ b/src/state-summary/state-card-select.ts @@ -8,6 +8,7 @@ import "../components/entity/state-badge"; import { UNAVAILABLE } from "../data/entity"; import { SelectEntity, setSelectOption } from "../data/select"; import type { HomeAssistant } from "../types"; +import { computeStateDisplay } from "../common/entity/compute_state_display"; @customElement("state-card-select") class StateCardSelect extends LitElement { @@ -31,12 +32,13 @@ class StateCardSelect extends LitElement { (option) => html` - ${(this.stateObj.attributes.device_class && - this.hass.localize( - `component.select.state.${this.stateObj.attributes.device_class}.${option}` - )) || - this.hass.localize(`component.select.state._.${option}`) || - option} + ${computeStateDisplay( + this.hass.localize, + this.stateObj, + this.hass.locale, + this.hass.entities, + option + )} ` )}