From afa60b4c196b1d78546317ce0e729e05b0b45d3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20RAMAGE?= Date: Fri, 29 Jun 2018 09:42:06 +0200 Subject: [PATCH] don't update last_seen on persistent loading --- zigate/__init__.py | 2 +- zigate/core.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/zigate/__init__.py b/zigate/__init__.py index 42e0a6f9..30c8f7ed 100644 --- a/zigate/__init__.py +++ b/zigate/__init__.py @@ -4,7 +4,7 @@ from .const import * from pydispatch import dispatcher -__version__ = '0.16.3' +__version__ = '0.16.4' __all__ = ['ZiGate', 'ZiGateWiFi', 'dispatcher'] diff --git a/zigate/core.py b/zigate/core.py index d6a256b7..328b5755 100644 --- a/zigate/core.py +++ b/zigate/core.py @@ -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) @@ -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() @@ -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: @@ -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): @@ -1666,6 +1670,4 @@ def _avoid_duplicate(self): attribute['attribute']) attr['name'] = attribute['name'] properties.append(attribute['name']) - -