mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 12:15:08 +02:00
@@ -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
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user