diff --git a/src/panels/lovelace/cards/hui-entity-card.ts b/src/panels/lovelace/cards/hui-entity-card.ts
index 28c7709926..5c46621b55 100644
--- a/src/panels/lovelace/cards/hui-entity-card.ts
+++ b/src/panels/lovelace/cards/hui-entity-card.ts
@@ -125,11 +125,12 @@ export class HuiEntityCard extends LitElement implements LovelaceCard {
${"attribute" in this._config
- ? formatAttributeValue(
- this.hass,
- stateObj.attributes[this._config.attribute!] ??
- this.hass.localize("state.default.unknown")
- )
+ ? stateObj.attributes[this._config.attribute!] !== undefined
+ ? formatAttributeValue(
+ this.hass,
+ stateObj.attributes[this._config.attribute!]
+ )
+ : this.hass.localize("state.default.unknown")
: stateObj.attributes.unit_of_measurement
? formatNumber(stateObj.state, this.hass.locale)
: computeStateDisplay(