Skip to content

Commit ac4f0d7

Browse files
committed
Adapt to difference in response format
1 parent 602797d commit ac4f0d7

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

plugwise_usb/nodes/circle.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -880,22 +880,10 @@ async def clock_synchronize(self) -> bool:
880880
return False
881881

882882
dt_now = datetime.now(tz=UTC)
883-
dt_now_date = dt_now.replace(hour=0, minute=0, second=0, microsecond=0)
884-
response_date = datetime(
885-
response.date.value.year,
886-
response.date.value.month,
887-
response.date.value.day,
888-
hour=0,
889-
minute=0,
890-
second=0,
891-
microsecond=0,
892-
tzinfo=UTC,
893-
)
894-
if dt_now_date != response_date:
883+
if dt_now.weekday() != response.day_of_week.value:
895884
_LOGGER.info(
896-
"Sync clock of node %s because time has drifted %s days",
885+
"Sync clock of node %s because time has drifted more than 1 day",
897886
self._mac_in_str,
898-
int(abs((dt_now_date - response_date).days)),
899887
)
900888
return await self._send_clock_set_req()
901889

0 commit comments

Comments
 (0)