Fix brightness on button card (#14724)

This commit is contained in:
Paul Bottein 2022-12-13 14:02:48 +01:00 committed by GitHub
parent d64bb98bb4
commit 2d7973af79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -309,7 +309,7 @@ export class HuiButtonCard extends LitElement implements LovelaceCard {
} }
private _computeBrightness(stateObj: HassEntity | LightEntity): string { private _computeBrightness(stateObj: HassEntity | LightEntity): string {
if (!stateObj.attributes.brightness && stateActive(stateObj)) { if (stateObj.attributes.brightness) {
const brightness = stateObj.attributes.brightness; const brightness = stateObj.attributes.brightness;
return `brightness(${(brightness + 245) / 5}%)`; return `brightness(${(brightness + 245) / 5}%)`;
} }
@ -319,7 +319,7 @@ export class HuiButtonCard extends LitElement implements LovelaceCard {
private _computeColor( private _computeColor(
stateObj: HassEntity | LightEntity stateObj: HassEntity | LightEntity
): string | undefined { ): string | undefined {
if (stateObj.attributes.rgb_color && stateActive(stateObj)) { if (stateObj.attributes.rgb_color) {
return `rgb(${stateObj.attributes.rgb_color.join(",")})`; return `rgb(${stateObj.attributes.rgb_color.join(",")})`;
} }
const iconColor = stateColorCss(stateObj); const iconColor = stateColorCss(stateObj);