diff --git a/src/panels/lovelace/hui-unused-entities.ts b/src/panels/lovelace/hui-unused-entities.ts index 07a681d79f..10769275cc 100644 --- a/src/panels/lovelace/hui-unused-entities.ts +++ b/src/panels/lovelace/hui-unused-entities.ts @@ -12,11 +12,12 @@ import { createCardElement } from "./common/create-card-element"; import { HomeAssistant } from "../../types"; import { LovelaceCard } from "./types"; import { LovelaceConfig } from "../../data/lovelace"; +import computeDomain from "../../common/entity/compute_domain"; export class HuiUnusedEntities extends LitElement { private _hass?: HomeAssistant; private _config?: LovelaceConfig; - private _element?: LovelaceCard; + private _elements?: LovelaceCard[]; static get properties(): PropertyDeclarations { return { @@ -27,16 +28,18 @@ export class HuiUnusedEntities extends LitElement { set hass(hass: HomeAssistant) { this._hass = hass; - if (!this._element) { - this._createElement(); + if (!this._elements) { + this._createElements(); return; } - this._element.hass = this._hass; + for (const element of this._elements) { + element.hass = this._hass; + } } public setConfig(config: LovelaceConfig): void { this._config = config; - this._createElement(); + this._createElements(); } protected render(): TemplateResult | void { @@ -46,7 +49,7 @@ export class HuiUnusedEntities extends LitElement { return html` ${this.renderStyle()} -