From 7176942ed2e60eecdff11395015ebbcb8cc5e9a7 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Tue, 24 Aug 2021 21:03:41 +0200 Subject: [PATCH] refactor time handling --- custom_components/plejd/light.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/custom_components/plejd/light.py b/custom_components/plejd/light.py index 75c041d..95dc69f 100644 --- a/custom_components/plejd/light.py +++ b/custom_components/plejd/light.py @@ -324,11 +324,15 @@ def handle_notification_cb(iface, changed_props, invalidated_props): if dec[0] in PLEJD_DEVICES: device = PLEJD_DEVICES[dec[0]] elif dec[0] == 0x01 and dec[3:5] == b'\x00\x1b': - n = dt_util.now().replace(tzinfo=None) - time = datetime.fromtimestamp(struct.unpack_from(' TIME_DELTA_SYNC: _LOGGER.info("Plejd time delta is %d seconds, setting time to '%s'.", s, n)