Skip to content

Commit c671238

Browse files
SaccaSacca
authored andcommitted
Fixed issue with now() and datetime
1 parent fa9ed64 commit c671238

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

custom_components/uhoo/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""The uHoo Component"""
22

33
from asyncio import gather
4-
from datetime import now, timedelta, timezone
4+
from datetime import datetime, timedelta, timezone
55

66
import async_timeout
77
from pyuhoo import Client
@@ -80,7 +80,7 @@ def unique_id(self):
8080
def available(self):
8181
"""Return if sensor is available."""
8282
device = self.coordinator.data[self.serial_number]
83-
is_fresh = (now(timezone.utc) - device.timestamp) < timedelta(minutes=5)
83+
is_fresh = (datetime.now(timezone.utc) - device.timestamp) < timedelta(minutes=5)
8484
return self.coordinator.last_update_success and is_fresh
8585

8686
@property

0 commit comments

Comments
 (0)