diff --git a/src/components/entity/ha-state-label-badge.ts b/src/components/entity/ha-state-label-badge.ts index c51309ccfb..155294ef75 100644 --- a/src/components/entity/ha-state-label-badge.ts +++ b/src/components/entity/ha-state-label-badge.ts @@ -22,6 +22,7 @@ import { isNumericState, } from "../../common/number/format_number"; import { isUnavailableState, UNAVAILABLE, UNKNOWN } from "../../data/entity"; +import { EntityRegistryEntry } from "../../data/entity_registry"; import { timerTimeRemaining } from "../../data/timer"; import { HomeAssistant } from "../../types"; import "../ha-label-badge"; @@ -103,8 +104,10 @@ export class HaStateLabelBadge extends LitElement { // 4. Icon determined via entity state // 5. Value string as fallback const domain = computeStateDomain(entityState); + const entry = this.hass?.entities[entityState.entity_id]; - const showIcon = this.icon || this._computeShowIcon(domain, entityState); + const showIcon = + this.icon || this._computeShowIcon(domain, entityState, entry); const image = this.icon ? "" : this.image @@ -112,7 +115,9 @@ export class HaStateLabelBadge extends LitElement { : entityState.attributes.entity_picture_local || entityState.attributes.entity_picture; const value = - !image && !showIcon ? this._computeValue(domain, entityState) : undefined; + !image && !showIcon + ? this._computeValue(domain, entityState, entry) + : undefined; return html`