Use native datetime value in UniFi sensors (#59926)

pull/59657/head^2
Franck Nijhof 2021-11-19 07:35:09 +01:00 committed by GitHub
parent a3d5aec778
commit f7b7786d0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -172,8 +172,8 @@ class UniFiUpTimeSensor(UniFiClient, SensorEntity):
def native_value(self) -> datetime:
"""Return the uptime of the client."""
if self.client.uptime < 1000000000:
return (dt_util.now() - timedelta(seconds=self.client.uptime)).isoformat()
return dt_util.utc_from_timestamp(float(self.client.uptime)).isoformat()
return dt_util.now() - timedelta(seconds=self.client.uptime)
return dt_util.utc_from_timestamp(float(self.client.uptime))
async def options_updated(self) -> None:
"""Config entry options are updated, remove entity if option is disabled."""