mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-08 18:06:36 +00:00
Update to Togglable entities
This commit is contained in:
parent
18be134ad8
commit
76e67d27e7
@ -86,13 +86,13 @@ class HuiEntitiesCard extends HassLocalizeLitMixin(LitElement)
|
|||||||
const { show_header_toggle, title } = this.config;
|
const { show_header_toggle, title } = this.config;
|
||||||
const states = this.hass.states;
|
const states = this.hass.states;
|
||||||
|
|
||||||
const stateEntities = this.configEntities!.filter(
|
const entities = this.configEntities!.filter(
|
||||||
(conf) => conf.entity in states
|
(conf) => conf.entity in states
|
||||||
);
|
);
|
||||||
|
|
||||||
const rowEntities = this.configEntities!.filter(
|
const toggableEntities = entities
|
||||||
(item) => typeof item === "string" || item.entity
|
.filter((item) => typeof item === "string" || item.entity)
|
||||||
).map((item) => (typeof item === "string" ? item : item.entity));
|
.map((item) => (typeof item === "string" ? item : item.entity));
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
${this.renderStyle()}
|
${this.renderStyle()}
|
||||||
@ -109,7 +109,7 @@ class HuiEntitiesCard extends HassLocalizeLitMixin(LitElement)
|
|||||||
: html`
|
: html`
|
||||||
<hui-entities-toggle
|
<hui-entities-toggle
|
||||||
.hass="${this.hass}"
|
.hass="${this.hass}"
|
||||||
.entities="${rowEntities}"
|
.entities="${toggableEntities}"
|
||||||
>
|
>
|
||||||
</hui-entities-toggle>`
|
</hui-entities-toggle>`
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ class HuiEntitiesCard extends HassLocalizeLitMixin(LitElement)
|
|||||||
}
|
}
|
||||||
<div id="states">
|
<div id="states">
|
||||||
${repeat<EntityConfig>(
|
${repeat<EntityConfig>(
|
||||||
stateEntities,
|
entities,
|
||||||
(entityConf) => entityConf.entity,
|
(entityConf) => entityConf.entity,
|
||||||
(entityConf) => this.renderEntity(entityConf)
|
(entityConf) => this.renderEntity(entityConf)
|
||||||
)}
|
)}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user