From 56e01e66fb101085c0fb379739883ae9bac37b5d Mon Sep 17 00:00:00 2001 From: Zack Arnett Date: Sun, 21 Oct 2018 19:05:56 -0400 Subject: [PATCH] Review fix --- .../lovelace/cards/hui-entities-card.ts | 42 +++++++------------ 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/src/panels/lovelace/cards/hui-entities-card.ts b/src/panels/lovelace/cards/hui-entities-card.ts index b4f38116a3..022d31deda 100644 --- a/src/panels/lovelace/cards/hui-entities-card.ts +++ b/src/panels/lovelace/cards/hui-entities-card.ts @@ -36,31 +36,21 @@ class HuiEntitiesCard extends HassLocalizeLitMixin(LitElement) protected config?: Config; protected configEntities?: EntityConfig[]; - // set hass(hass) { - // console.log("here"); - // this._hass = hass; - - // console.log(this.shadowRoot); - // console.log( - // this.shadowRoot && this.shadowRoot.querySelector("ha-card") - // ? this.shadowRoot - // .querySelector("ha-card")! - // .querySelectorAll("#states > div > *") - // : "" - // ); - // if (this.shadowRoot && this.shadowRoot.querySelector("ha-card")) { - // this.shadowRoot - // .querySelector("ha-card")! - // .querySelectorAll("#states > div > *") - // .forEach((element: any) => { - // element.hass = hass; - // }); - // } - // } + set hass(hass) { + this._hass = hass; + if (this.shadowRoot && this.shadowRoot.querySelector("ha-card")) { + this.shadowRoot + .querySelector("ha-card")! + .querySelectorAll("#states > div > *") + .forEach((element: any) => { + element.hass = hass; + }); + } + } static get properties(): PropertyDeclarations { return { - hass: {}, + _hass: {}, config: {}, }; } @@ -74,8 +64,6 @@ class HuiEntitiesCard extends HassLocalizeLitMixin(LitElement) } public setConfig(config: Config) { - console.log(config); - const entities = processConfigEntities(config.entities); for (const entity of entities) { if ( @@ -100,7 +88,7 @@ class HuiEntitiesCard extends HassLocalizeLitMixin(LitElement) } protected render() { - if (!this.config || !this.hass) { + if (!this.config || !this._hass) { return html``; } const { show_header_toggle, title } = this.config; @@ -119,7 +107,7 @@ class HuiEntitiesCard extends HassLocalizeLitMixin(LitElement) ? html`` : html`