mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-24 13:27:22 +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) {
|
||||
const brightness = newVal.attributes.brightness;
|
||||
// lowest brighntess will be around 50% (that's pretty dark)
|
||||
iconStyle.filter = `brightness(${(parseInt(brightness) + 245) / 5}%)`;
|
||||
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)
|
||||
iconStyle.filter = `brightness(${(brightness + 245) / 5}%)`;
|
||||
}
|
||||
}
|
||||
}
|
||||
Object.assign(this.$.icon.style, iconStyle);
|
||||
|
Loading…
x
Reference in New Issue
Block a user