diff --git a/src/components/entity/state-badge.ts b/src/components/entity/state-badge.ts index 172c56261b..c201e50b8c 100644 --- a/src/components/entity/state-badge.ts +++ b/src/components/entity/state-badge.ts @@ -76,7 +76,7 @@ export class StateBadge extends LitElement { } hostStyle.backgroundImage = `url(${imageUrl})`; iconStyle.display = "none"; - } else { + } else if (stateObj.state === "on") { if (stateObj.attributes.hs_color && this.stateColor !== false) { const hue = stateObj.attributes.hs_color[0]; const sat = stateObj.attributes.hs_color[1]; diff --git a/src/panels/lovelace/cards/hui-light-card.ts b/src/panels/lovelace/cards/hui-light-card.ts index 51fcd575f8..23b2b46427 100644 --- a/src/panels/lovelace/cards/hui-light-card.ts +++ b/src/panels/lovelace/cards/hui-light-card.ts @@ -233,7 +233,7 @@ export class HuiLightCard extends LitElement implements LovelaceCard { } private _computeBrightness(stateObj: LightEntity): string { - if (!stateObj.attributes.brightness) { + if (stateObj.state === "off" || !stateObj.attributes.brightness) { return ""; } const brightness = stateObj.attributes.brightness; @@ -241,7 +241,7 @@ export class HuiLightCard extends LitElement implements LovelaceCard { } private _computeColor(stateObj: LightEntity): string { - if (!stateObj.attributes.hs_color) { + if (stateObj.state === "off" || !stateObj.attributes.hs_color) { return ""; } const [hue, sat] = stateObj.attributes.hs_color;