From 5ed613049ee76f3d93c0c61b0d0532ab43bc2b23 Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Wed, 21 Oct 2020 23:00:31 -0500 Subject: [PATCH] Add last-updated as a secondaryinfo option --- src/panels/lovelace/cards/types.ts | 1 + src/panels/lovelace/components/hui-generic-entity-row.ts | 7 +++++++ .../config-elements/hui-generic-entity-row-editor.ts | 1 + src/translations/en.json | 3 ++- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/panels/lovelace/cards/types.ts b/src/panels/lovelace/cards/types.ts index 6ecb657ad537..f7e173e72fc8 100644 --- a/src/panels/lovelace/cards/types.ts +++ b/src/panels/lovelace/cards/types.ts @@ -45,6 +45,7 @@ export interface EntitiesCardEntityConfig extends EntityConfig { | "entity-id" | "last-changed" | "last-triggered" + | "last-updated" | "position" | "tilt-position" | "brightness"; diff --git a/src/panels/lovelace/components/hui-generic-entity-row.ts b/src/panels/lovelace/components/hui-generic-entity-row.ts index 5831526e292a..d8abefe0da42 100644 --- a/src/panels/lovelace/components/hui-generic-entity-row.ts +++ b/src/panels/lovelace/components/hui-generic-entity-row.ts @@ -97,6 +97,13 @@ class HuiGenericEntityRow extends LitElement { .datetime=${stateObj.last_changed} > ` + : this.config.secondary_info === "last-updated" + ? html` + + ` : this.config.secondary_info === "last-triggered" ? stateObj.attributes.last_triggered ? html` diff --git a/src/panels/lovelace/editor/config-elements/hui-generic-entity-row-editor.ts b/src/panels/lovelace/editor/config-elements/hui-generic-entity-row-editor.ts index 8ff2d4cdecb3..e2164073cab8 100644 --- a/src/panels/lovelace/editor/config-elements/hui-generic-entity-row-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-generic-entity-row-editor.ts @@ -31,6 +31,7 @@ import { configElementStyle } from "./config-elements-style"; const SecondaryInfoValues: { [key: string]: { domains?: string[] } } = { "entity-id": {}, "last-changed": {}, + "last-updated": {}, "last-triggered": { domains: ["automation", "script"] }, position: { domains: ["cover"] }, "tilt-position": { domains: ["cover"] }, diff --git a/src/translations/en.json b/src/translations/en.json index 284f5745136b..8a8d8d2c1c5e 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2452,7 +2452,8 @@ "last-triggered": "Last Triggered", "position": "Position", "tilt-position": "Tilt Position", - "brightness": "Brightness" + "brightness": "Brightness", + "last-updated": "Last Updated" }, "entity_row": { "divider": "Divider",