Skip to content

Commit

Permalink
update the 'last seen' value when the RSSI is updated in order to pus…
Browse files Browse the repository at this point in the history
…h automatically the new value to grafana / influxdb ( instead of waiting the next status change )
  • Loading branch information
root committed Jun 28, 2018
1 parent 26b3e68 commit 1aa3878
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyzigate/interface.py
Expand Up @@ -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
Expand Down

0 comments on commit 1aa3878

Please sign in to comment.