From 8e68c937d3f383465f40b356bf9209ad3c03cd23 Mon Sep 17 00:00:00 2001 From: Ryan Adolf Date: Sat, 9 Oct 2021 14:20:27 -0700 Subject: [PATCH] 1.12.0rc0: Version logging and tidy up card name config passing --- package.json | 2 +- src/timer-bar-card.ts | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b8e777b..c942da3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lovelace-timer-bar-card", - "version": "1.11.0", + "version": "1.12.0rc0", "description": "Progress bar display for Home Assistant timers", "keywords": [ "home-assistant", diff --git a/src/timer-bar-card.ts b/src/timer-bar-card.ts index 84ef6d7..cda3aa4 100644 --- a/src/timer-bar-card.ts +++ b/src/timer-bar-card.ts @@ -9,6 +9,7 @@ import { fillConfig, TimerBarEntityRow } from './timer-bar-entity-row'; import type { TimerBarConfig, TimerBarEntityConfig, AttributeConfig } from './types'; import { isState } from './helpers'; import { PropertyValues } from 'lit-element'; +import { version } from '../package.json'; // This puts your card into the UI card picker dialog (window as any).customCards = (window as any).customCards || []; @@ -19,6 +20,11 @@ import { PropertyValues } from 'lit-element'; }); window.customElements.define('timer-bar-entity-row', TimerBarEntityRow); +console.info( + `%c TIMER-BAR-CARD %c Version ${version} `, + 'font-weight: bold; background: #aeb', + 'font-weight: bold; background: #ddd', +); @customElement('timer-bar-card') export class TimerBarCard extends LitElement { @@ -95,9 +101,12 @@ export class TimerBarCard extends LitElement { private _renderContent(): TemplateResult[] { return this._filteredEntities().map(entity => { const style = this.config.compressed ? { height: '36px' } : {}; - let config = { ...this.config, entity, name: '' }; + let config: TimerBarEntityConfig = { ...this.config }; + delete config.name // so card name does not override entity name // Merge in per-entity configuration - if (typeof entity !== 'string') config = { ...config, ...entity }; + if (typeof entity === 'string') config.entity = entity; + else config = { ...config, ...entity }; + // Create a entity-row component for every entity return html`