Skip to content

Commit

Permalink
don't update last_seen on persistent loading
Browse files Browse the repository at this point in the history
  • Loading branch information
doudz committed Jun 29, 2018
1 parent 4b3a051 commit afa60b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion zigate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .const import *
from pydispatch import dispatcher

__version__ = '0.16.3'
__version__ = '0.16.4'

__all__ = ['ZiGate', 'ZiGateWiFi',
'dispatcher']
8 changes: 5 additions & 3 deletions zigate/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def __init__(self, port='auto', path='~/.zigate.json',

self._addr = None
self._ieee = None
self._started = False

dispatcher.connect(self.interpret_response, ZIGATE_RESPONSE_RECEIVED)
dispatcher.connect(self.decode_data, ZIGATE_PACKET_RECEIVED)
Expand All @@ -124,6 +125,7 @@ def close(self):
except Exception as e:
LOGGER.error('Exception during closing')
LOGGER.error(traceback.format_exc())
self._started = False

def save_state(self, path=None):
self._save_lock.acquire()
Expand Down Expand Up @@ -184,6 +186,8 @@ def autoStart(self):
- Start Network
- Refresh devices list
'''
if self._started:
return
self.load_state()
# erase = not self.load_state()
# if erase:
Expand Down Expand Up @@ -1447,7 +1451,7 @@ def update(self, device):
self._lock.acquire()
self.info.update(device.info)
self.endpoints.update(device.endpoints)
self.info['last_seen'] = strftime('%Y-%m-%d %H:%M:%S')
# self.info['last_seen'] = strftime('%Y-%m-%d %H:%M:%S')
self._lock.release()

def update_info(self, info):
Expand Down Expand Up @@ -1666,6 +1670,4 @@ def _avoid_duplicate(self):
attribute['attribute'])
attr['name'] = attribute['name']
properties.append(attribute['name'])



0 comments on commit afa60b4

Please sign in to comment.