mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-31 21:17:47 +00:00
handle brightness reporting while light off (#5391)
This commit is contained in:
parent
c351402556
commit
465efa460e
@ -76,7 +76,7 @@ export class StateBadge extends LitElement {
|
|||||||
}
|
}
|
||||||
hostStyle.backgroundImage = `url(${imageUrl})`;
|
hostStyle.backgroundImage = `url(${imageUrl})`;
|
||||||
iconStyle.display = "none";
|
iconStyle.display = "none";
|
||||||
} else {
|
} else if (stateObj.state === "on") {
|
||||||
if (stateObj.attributes.hs_color && this.stateColor !== false) {
|
if (stateObj.attributes.hs_color && this.stateColor !== false) {
|
||||||
const hue = stateObj.attributes.hs_color[0];
|
const hue = stateObj.attributes.hs_color[0];
|
||||||
const sat = stateObj.attributes.hs_color[1];
|
const sat = stateObj.attributes.hs_color[1];
|
||||||
|
@ -233,7 +233,7 @@ export class HuiLightCard extends LitElement implements LovelaceCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _computeBrightness(stateObj: LightEntity): string {
|
private _computeBrightness(stateObj: LightEntity): string {
|
||||||
if (!stateObj.attributes.brightness) {
|
if (stateObj.state === "off" || !stateObj.attributes.brightness) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
const brightness = stateObj.attributes.brightness;
|
const brightness = stateObj.attributes.brightness;
|
||||||
@ -241,7 +241,7 @@ export class HuiLightCard extends LitElement implements LovelaceCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _computeColor(stateObj: LightEntity): string {
|
private _computeColor(stateObj: LightEntity): string {
|
||||||
if (!stateObj.attributes.hs_color) {
|
if (stateObj.state === "off" || !stateObj.attributes.hs_color) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
const [hue, sat] = stateObj.attributes.hs_color;
|
const [hue, sat] = stateObj.attributes.hs_color;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user