mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-02 14:07:55 +00:00
Handle unknown state (#4481)
This commit is contained in:
parent
bc731a9dc3
commit
aaefe0b09f
@ -145,7 +145,7 @@ export class HaDevicesDataTable extends LitElement {
|
|||||||
return html`
|
return html`
|
||||||
${name}<br />
|
${name}<br />
|
||||||
${device.area} | ${device.integration}<br />
|
${device.area} | ${device.integration}<br />
|
||||||
${battery
|
${battery && !isNaN(battery.state as any)
|
||||||
? html`
|
? html`
|
||||||
${battery.state}%
|
${battery.state}%
|
||||||
<ha-state-icon
|
<ha-state-icon
|
||||||
@ -205,7 +205,7 @@ export class HaDevicesDataTable extends LitElement {
|
|||||||
const battery = batteryEntity
|
const battery = batteryEntity
|
||||||
? this.hass.states[batteryEntity]
|
? this.hass.states[batteryEntity]
|
||||||
: undefined;
|
: undefined;
|
||||||
return battery
|
return battery && !isNaN(battery.state as any)
|
||||||
? html`
|
? html`
|
||||||
${battery.state}%
|
${battery.state}%
|
||||||
<ha-state-icon
|
<ha-state-icon
|
||||||
|
@ -62,7 +62,8 @@ class HuiSensorEntityRow extends LitElement implements EntityRow {
|
|||||||
<hui-generic-entity-row .hass="${this.hass}" .config="${this._config}">
|
<hui-generic-entity-row .hass="${this.hass}" .config="${this._config}">
|
||||||
<div>
|
<div>
|
||||||
${stateObj.attributes.device_class === "timestamp" &&
|
${stateObj.attributes.device_class === "timestamp" &&
|
||||||
stateObj.state !== "unavailable"
|
stateObj.state !== "unavailable" &&
|
||||||
|
stateObj.state !== "unknown"
|
||||||
? html`
|
? html`
|
||||||
<hui-timestamp-display
|
<hui-timestamp-display
|
||||||
.hass="${this.hass}"
|
.hass="${this.hass}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user