From 845511e32208e647b95763630e0866c6323cc644 Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Tue, 12 May 2020 11:29:43 -0500 Subject: [PATCH] Add 'brightness' as a secondary_info option (#5731) --- src/panels/lovelace/cards/types.ts | 3 ++- src/panels/lovelace/components/hui-generic-entity-row.ts | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/panels/lovelace/cards/types.ts b/src/panels/lovelace/cards/types.ts index 1d3fbea65b..3ce3342309 100644 --- a/src/panels/lovelace/cards/types.ts +++ b/src/panels/lovelace/cards/types.ts @@ -34,7 +34,8 @@ export interface EntitiesCardEntityConfig extends EntityConfig { | "last-changed" | "last-triggered" | "position" - | "tilt-position"; + | "tilt-position" + | "brightness"; action_name?: string; service?: string; service_data?: object; diff --git a/src/panels/lovelace/components/hui-generic-entity-row.ts b/src/panels/lovelace/components/hui-generic-entity-row.ts index fe154e0775..a33127ce02 100644 --- a/src/panels/lovelace/components/hui-generic-entity-row.ts +++ b/src/panels/lovelace/components/hui-generic-entity-row.ts @@ -122,6 +122,11 @@ class HuiGenericEntityRow extends LitElement { ? `${this.hass.localize("ui.card.cover.tilt_position")}: ${ stateObj.attributes.current_tilt_position }` + : this.config.secondary_info === "brightness" && + stateObj.attributes.brightness + ? html`${Math.round( + (stateObj.attributes.brightness / 255) * 100 + )}%` : "")} `