mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 17:26:42 +00:00
Prevent formatting for unknown attribute (#9252)
This commit is contained in:
parent
465a91dbf3
commit
f55e911313
@ -125,11 +125,12 @@ export class HuiEntityCard extends LitElement implements LovelaceCard {
|
|||||||
<div class="info">
|
<div class="info">
|
||||||
<span class="value"
|
<span class="value"
|
||||||
>${"attribute" in this._config
|
>${"attribute" in this._config
|
||||||
? formatAttributeValue(
|
? stateObj.attributes[this._config.attribute!] !== undefined
|
||||||
this.hass,
|
? formatAttributeValue(
|
||||||
stateObj.attributes[this._config.attribute!] ??
|
this.hass,
|
||||||
this.hass.localize("state.default.unknown")
|
stateObj.attributes[this._config.attribute!]
|
||||||
)
|
)
|
||||||
|
: this.hass.localize("state.default.unknown")
|
||||||
: stateObj.attributes.unit_of_measurement
|
: stateObj.attributes.unit_of_measurement
|
||||||
? formatNumber(stateObj.state, this.hass.locale)
|
? formatNumber(stateObj.state, this.hass.locale)
|
||||||
: computeStateDisplay(
|
: computeStateDisplay(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user