diff --git a/src/data/lovelace_custom_cards.ts b/src/data/lovelace_custom_cards.ts index 67a795045928..c79cfb4584e8 100644 --- a/src/data/lovelace_custom_cards.ts +++ b/src/data/lovelace_custom_cards.ts @@ -44,10 +44,10 @@ if (!("customCardFeatures" in customCardsWindow)) { customCardsWindow.customCardFeatures = []; } if (!("customBadges" in customCardsWindow)) { - customCardsWindow.customCardFeatures = []; + customCardsWindow.customBadges = []; } if (!("customTileFeatures" in customCardsWindow)) { - customCardsWindow.customBadges = []; + customCardsWindow.customTileFeatures = []; } export const customCards = customCardsWindow.customCards!; diff --git a/src/panels/lovelace/badges/hui-entity-badge.ts b/src/panels/lovelace/badges/hui-entity-badge.ts index 01e182cfad3e..9ee1e851af6e 100644 --- a/src/panels/lovelace/badges/hui-entity-badge.ts +++ b/src/panels/lovelace/badges/hui-entity-badge.ts @@ -1,6 +1,7 @@ import { HassEntity } from "home-assistant-js-websocket"; import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; +import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; @@ -14,11 +15,11 @@ import "../../../components/ha-state-icon"; import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; +import { findEntities } from "../common/find-entities"; import { handleAction } from "../common/handle-action"; import { hasAction } from "../common/has-action"; import { LovelaceBadge, LovelaceBadgeEditor } from "../types"; import { EntityBadgeConfig } from "./types"; -import { findEntities } from "../common/find-entities"; @customElement("hui-entity-badge") export class HuiEntityBadge extends LitElement implements LovelaceBadge { @@ -108,6 +109,7 @@ export class HuiEntityBadge extends LitElement implements LovelaceBadge { return nothing; } + const active = stateActive(stateObj); const color = this._computeStateColor(stateObj, this._config.color); const style = { @@ -126,7 +128,7 @@ export class HuiEntityBadge extends LitElement implements LovelaceBadge { return html`
0 + ${badges?.length > 0 || editMode ? html`