From 1aa3878c039b154bb4466bc6dd14620b410b304d Mon Sep 17 00:00:00 2001 From: root Date: Thu, 28 Jun 2018 17:21:22 +0200 Subject: [PATCH] update the 'last seen' value when the RSSI is updated in order to push automatically the new value to grafana / influxdb ( instead of waiting the next status change ) --- pyzigate/interface.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyzigate/interface.py b/pyzigate/interface.py index 1e12fb5..1556fc8 100644 --- a/pyzigate/interface.py +++ b/pyzigate/interface.py @@ -330,10 +330,12 @@ def decode_data(self, data): if str(device[:4]) == msg['addr'].decode('UTF-8'): # Update the device with Link Quality value self.set_device_property(msg['addr'], device[4:6].encode(), "Link_quality", '{}'.format(msg['link_quality'])) + self.set_device_property(msg['addr'], device[4:6].encode(), ZGT_LAST_SEEN, strftime('%Y-%m-%d %H:%M:%S')) else: ZGT_LOG.error('{} dead ? '.format(msg['ID'])) self.set_device_property(msg['addr'], device[4:6].encode(), "Link_quality", '0') + self.set_device_property(msg['addr'], device[4:6].encode(), ZGT_LAST_SEEN, strftime('%Y-%m-%d %H:%M:%S')) if len(msg['next']) < 13: break