forked from home-assistant/core
Fix ZeroDivisionError on freebox/sensor (#57077)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
committed by
Paulus Schoutsen
parent
4fffeb1155
commit
3650a5e2a4
@@ -177,6 +177,9 @@ class FreeboxDiskSensor(FreeboxSensor):
|
|||||||
@callback
|
@callback
|
||||||
def async_update_state(self) -> None:
|
def async_update_state(self) -> None:
|
||||||
"""Update the Freebox disk sensor."""
|
"""Update the Freebox disk sensor."""
|
||||||
self._attr_native_value = round(
|
value = None
|
||||||
|
if self._partition.get("total_bytes"):
|
||||||
|
value = round(
|
||||||
self._partition["free_bytes"] * 100 / self._partition["total_bytes"], 2
|
self._partition["free_bytes"] * 100 / self._partition["total_bytes"], 2
|
||||||
)
|
)
|
||||||
|
self._attr_native_value = value
|
||||||
|
Reference in New Issue
Block a user