diff --git a/src/panels/lovelace/cards/types.ts b/src/panels/lovelace/cards/types.ts index 009616ddee..e00b58b83f 100644 --- a/src/panels/lovelace/cards/types.ts +++ b/src/panels/lovelace/cards/types.ts @@ -33,6 +33,8 @@ export interface EntitiesCardEntityConfig extends EntityConfig { hold_action?: ActionConfig; double_tap_action?: ActionConfig; state_color?: boolean; + show_name?: boolean; + show_icon?: boolean; } export interface EntitiesCardConfig extends LovelaceCardConfig { diff --git a/src/panels/lovelace/components/hui-buttons-base.ts b/src/panels/lovelace/components/hui-buttons-base.ts index c0890e51b4..3533028682 100644 --- a/src/panels/lovelace/components/hui-buttons-base.ts +++ b/src/panels/lovelace/components/hui-buttons-base.ts @@ -22,6 +22,7 @@ import { hasAction } from "../common/has-action"; import { ActionHandlerEvent } from "../../../data/lovelace"; import { handleAction } from "../common/handle-action"; import { EntitiesCardEntityConfig } from "../cards/types"; +import { computeStateName } from "../../../common/entity/compute_state_name"; @customElement("hui-buttons-base") export class HuiButtonsBase extends LitElement { @@ -31,9 +32,12 @@ export class HuiButtonsBase extends LitElement { set hass(hass: HomeAssistant) { this._hass = hass; + const entitiesShowingIcons = this.configEntities?.filter( + (entity) => entity.show_icon !== false + ); this._badges.forEach((badge, index: number) => { badge.hass = hass; - badge.stateObj = hass.states[this.configEntities![index].entity]; + badge.stateObj = hass.states[entitiesShowingIcons![index].entity]; }); } @@ -46,22 +50,33 @@ export class HuiButtonsBase extends LitElement { } return html` -