From d16daf0fd96a677732e643c558b2b5dbb3f2e303 Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Thu, 22 Oct 2020 05:37:51 -0500 Subject: [PATCH] Add last-updated as a secondaryinfo option to entity rows (#7433) --- 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 6ecb657ad5..f7e173e72f 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 5831526e29..d8abefe0da 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 8ff2d4cdec..e2164073ca 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 284f574513..8a8d8d2c1c 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",