Fix secondary info (#5159)

This commit is contained in:
Bram Kragten 2020-03-12 20:09:41 +01:00 committed by GitHub
parent f54cd18da4
commit 3b1f9a5dab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,27 +94,27 @@ class HuiGenericEntityRow extends LitElement {
? html` ? html`
<div class="secondary"> <div class="secondary">
${this.secondaryText || ${this.secondaryText ||
this.config.secondary_info === "entity-id" (this.config.secondary_info === "entity-id"
? stateObj.entity_id ? stateObj.entity_id
: this.config.secondary_info === "last-changed" : this.config.secondary_info === "last-changed"
? html`
<ha-relative-time
.hass=${this.hass}
.datetime=${stateObj.last_changed}
></ha-relative-time>
`
: this.config.secondary_info === "last-triggered"
? stateObj.attributes.last_triggered
? html` ? html`
<ha-relative-time <ha-relative-time
.hass=${this.hass} .hass=${this.hass}
.datetime=${stateObj.attributes.last_triggered} .datetime=${stateObj.last_changed}
></ha-relative-time> ></ha-relative-time>
` `
: this.hass.localize( : this.config.secondary_info === "last-triggered"
"ui.panel.lovelace.cards.entities.never_triggered" ? stateObj.attributes.last_triggered
) ? html`
: ""} <ha-relative-time
.hass=${this.hass}
.datetime=${stateObj.attributes.last_triggered}
></ha-relative-time>
`
: this.hass.localize(
"ui.panel.lovelace.cards.entities.never_triggered"
)
: "")}
</div> </div>
` `
: ""} : ""}