mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 14:56:37 +00:00
Complain and ignore instead of fixing
This commit is contained in:
parent
1eb4ac7f34
commit
bdc2b31202
@ -88,8 +88,17 @@ class StateBadge extends PolymerElement {
|
|||||||
}
|
}
|
||||||
if (newVal.attributes.brightness) {
|
if (newVal.attributes.brightness) {
|
||||||
const brightness = newVal.attributes.brightness;
|
const brightness = newVal.attributes.brightness;
|
||||||
|
if (typeof brightness !== "number" || isNaN(brightness)) {
|
||||||
|
console.warn(
|
||||||
|
"Type error: state-badge expected number, but type of " +
|
||||||
|
newVal.entity_id +
|
||||||
|
".attributes.brightness is " +
|
||||||
|
typeof brightness
|
||||||
|
);
|
||||||
|
} else {
|
||||||
// lowest brighntess will be around 50% (that's pretty dark)
|
// lowest brighntess will be around 50% (that's pretty dark)
|
||||||
iconStyle.filter = `brightness(${(parseInt(brightness) + 245) / 5}%)`;
|
iconStyle.filter = `brightness(${(brightness + 245) / 5}%)`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Object.assign(this.$.icon.style, iconStyle);
|
Object.assign(this.$.icon.style, iconStyle);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user