Fix round typing [tradfri] (#82438)

This commit is contained in:
Marc Mueller 2022-11-21 08:51:04 +01:00 committed by GitHub
parent 71604f544b
commit 33e57c2e24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,6 +54,7 @@ class TradfriSensorEntityDescription(
def _get_air_quality(device: Device) -> int | None:
"""Fetch the air quality value."""
assert device.air_purifier_control is not None
if (
device.air_purifier_control.air_purifiers[0].air_quality == 65535
): # The sensor returns 65535 if the fan is turned off
@ -64,8 +65,12 @@ def _get_air_quality(device: Device) -> int | None:
def _get_filter_time_left(device: Device) -> int:
"""Fetch the filter's remaining life (in hours)."""
assert device.air_purifier_control is not None
return round(
device.air_purifier_control.air_purifiers[0].filter_lifetime_remaining / 60
cast(
int, device.air_purifier_control.air_purifiers[0].filter_lifetime_remaining
)
/ 60
)