mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
parent
e785d04abf
commit
24ab6fc31d
@ -146,7 +146,7 @@ def _get_breakdown_percent(
|
||||
"""Get a breakdown percent."""
|
||||
try:
|
||||
return round((attr["breakdown"][key] / denominator) * 100, 2)
|
||||
except ZeroDivisionError:
|
||||
except (ZeroDivisionError, KeyError):
|
||||
return 0
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user