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