From 5f95968c8fdc9985b7d00f07bdfbdd9e52d4e03e Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 2 Aug 2023 13:48:48 +0200 Subject: [PATCH] =?UTF-8?q?Make=20event=20entity=20row=20show=20time=20as?= =?UTF-8?q?=20relative=20by=20default,=20hide=20in=20gener=E2=80=A6=20(#17?= =?UTF-8?q?456)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/generate-lovelace-config.ts | 1 + .../entity-rows/hui-event-entity-row.ts | 29 ++++++++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/panels/lovelace/common/generate-lovelace-config.ts b/src/panels/lovelace/common/generate-lovelace-config.ts index 65b66c3ce1..673e8286a5 100644 --- a/src/panels/lovelace/common/generate-lovelace-config.ts +++ b/src/panels/lovelace/common/generate-lovelace-config.ts @@ -36,6 +36,7 @@ const HIDE_DOMAIN = new Set([ "script", "sun", "zone", + "event", ]); const HIDE_PLATFORM = new Set(["mobile_app"]); diff --git a/src/panels/lovelace/entity-rows/hui-event-entity-row.ts b/src/panels/lovelace/entity-rows/hui-event-entity-row.ts index cb6e097a50..f7abad2349 100644 --- a/src/panels/lovelace/entity-rows/hui-event-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-event-entity-row.ts @@ -68,16 +68,23 @@ class HuiEventEntityRow extends LitElement implements LovelaceRow { hasDoubleClick: hasAction(this._config.double_tap_action), })} > -
- ${computeStateDisplay( - this.hass!.localize, - stateObj, - this.hass.locale, - this.hass.config, - this.hass.entities - )} -
+ ${isUnavailableState(stateObj.state) + ? computeStateDisplay( + this.hass!.localize, + stateObj, + this.hass.locale, + this.hass.config, + this.hass.entities + ) + : html``} +
+
${isUnavailableState(stateObj.state) ? `` : computeAttributeValueDisplay( @@ -104,10 +111,10 @@ class HuiEventEntityRow extends LitElement implements LovelaceRow { text-align: right; } .when { - color: var(--secondary-text-color); + color: var(--primary-text-color); } .what { - color: var(--primary-text-color); + color: var(--secondary-text-color); } `; }