mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Fix uptime sensor for Vodafone Station (#130215)
This commit is contained in:
parent
c89ab7a142
commit
e6d16f06fc
@ -43,12 +43,10 @@ def _calculate_uptime(
|
|||||||
) -> datetime:
|
) -> datetime:
|
||||||
"""Calculate device uptime."""
|
"""Calculate device uptime."""
|
||||||
|
|
||||||
assert isinstance(last_value, datetime)
|
|
||||||
|
|
||||||
delta_uptime = coordinator.api.convert_uptime(coordinator.data.sensors[key])
|
delta_uptime = coordinator.api.convert_uptime(coordinator.data.sensors[key])
|
||||||
|
|
||||||
if (
|
if (
|
||||||
not last_value
|
not isinstance(last_value, datetime)
|
||||||
or abs((delta_uptime - last_value).total_seconds()) > UPTIME_DEVIATION
|
or abs((delta_uptime - last_value).total_seconds()) > UPTIME_DEVIATION
|
||||||
):
|
):
|
||||||
return delta_uptime
|
return delta_uptime
|
||||||
|
Loading…
x
Reference in New Issue
Block a user