mirror of
https://github.com/home-assistant/core.git
synced 2025-08-06 14:15:12 +02:00
Use native datetime value in UniFi sensors (#59926)
This commit is contained in:
@@ -172,8 +172,8 @@ class UniFiUpTimeSensor(UniFiClient, SensorEntity):
|
|||||||
def native_value(self) -> datetime:
|
def native_value(self) -> datetime:
|
||||||
"""Return the uptime of the client."""
|
"""Return the uptime of the client."""
|
||||||
if self.client.uptime < 1000000000:
|
if self.client.uptime < 1000000000:
|
||||||
return (dt_util.now() - timedelta(seconds=self.client.uptime)).isoformat()
|
return dt_util.now() - timedelta(seconds=self.client.uptime)
|
||||||
return dt_util.utc_from_timestamp(float(self.client.uptime)).isoformat()
|
return dt_util.utc_from_timestamp(float(self.client.uptime))
|
||||||
|
|
||||||
async def options_updated(self) -> None:
|
async def options_updated(self) -> None:
|
||||||
"""Config entry options are updated, remove entity if option is disabled."""
|
"""Config entry options are updated, remove entity if option is disabled."""
|
||||||
|
Reference in New Issue
Block a user