Skip to content

Commit

Permalink
1.12.0rc0: Version logging and tidy up card name config passing
Browse files Browse the repository at this point in the history
  • Loading branch information
rianadon committed Oct 9, 2021
1 parent c2fd8b0 commit 8e68c93
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
13 changes: 11 additions & 2 deletions src/timer-bar-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 || [];
Expand All @@ -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 {
Expand Down Expand Up @@ -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`<timer-bar-entity-row
.config=${config}
.hass=${this.hass}
Expand Down

0 comments on commit 8e68c93

Please sign in to comment.