This commit is contained in:
Thomas Lovén 2019-07-29 17:47:27 +02:00
parent 03e9f5eb87
commit 2c9a0600d7
3 changed files with 12 additions and 8 deletions

View File

@ -1,5 +1,5 @@
AUTHOR := Thomas Lovén AUTHOR := Thomas Lovén
CARD_TOOLS := $(PWD)/../../../custom-cards/card-tools CARD_TOOLS := $(PWD)/../card-tools
PACKAGE := $(shell basename $(CURDIR)) PACKAGE := $(shell basename $(CURDIR))
PACKAGE := $(PACKAGE:lovelace-%=%) PACKAGE := $(PACKAGE:lovelace-%=%)

File diff suppressed because one or more lines are too long

View File

@ -23,6 +23,10 @@ class FoldEntityRow extends LitElement {
this._config = Object.assign({}, defaults, config); this._config = Object.assign({}, defaults, config);
this.open = this.open || this._config.open; this.open = this.open || this._config.open;
this.head = this._config.head;
if (typeof this.head === "string")
this.head = {entity: this.head};
// Items are taken from the first available of the following // Items are taken from the first available of the following
// - The group specified as head // - The group specified as head
// - config entities: (this allows auto-population of the list) // - config entities: (this allows auto-population of the list)
@ -30,8 +34,8 @@ class FoldEntityRow extends LitElement {
this.items = this._config.items; this.items = this._config.items;
if (this._config.entities) if (this._config.entities)
this.items = this._config.entities; this.items = this._config.entities;
if (typeof this._config.head === "string" && this._config.head.startsWith("group.")) if (this.head.entity && this.head.entity.startsWith("group.") && !this.items)
this.items = hass().states[this._config.head].attributes.entity_id; this.items = hass().states[this.head.entity].attributes.entity_id;
} }
clickRow(ev) { clickRow(ev) {
@ -85,7 +89,7 @@ class FoldEntityRow extends LitElement {
return html` return html`
<div id="head" ?open=${this.open}> <div id="head" ?open=${this.open}>
<entity-row-maker <entity-row-maker
.config=${this._config.head} .config=${this.head}
.hass=${this.hass} .hass=${this.hass}
@click=${this.clickRow} @click=${this.clickRow}
head head