From cfd721636e1a99ac102ce24e393de419ae358a44 Mon Sep 17 00:00:00 2001 From: Matthew Wall Date: Sun, 16 Sep 2018 12:09:37 -0400 Subject: [PATCH] added logging for unknown exceptions in client. deal with missing utc times. --- bin/user/netatmo.py | 10 ++++++++-- changelog | 3 +++ install.py | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/bin/user/netatmo.py b/bin/user/netatmo.py index 8e9333d..74eb5f1 100644 --- a/bin/user/netatmo.py +++ b/bin/user/netatmo.py @@ -40,9 +40,10 @@ import weewx.drivers import weewx.engine import weewx.units import weewx.wxformulas +import weeutil.weeutil DRIVER_NAME = 'netatmo' -DRIVER_VERSION = "0.11" +DRIVER_VERSION = "0.12" INHG_PER_MBAR = 0.0295299830714 MPH_TO_KPH = 1.60934 @@ -323,6 +324,9 @@ class CloudClient(Collector): logdbg("waiting %s seconds before retry" % self._retry_wait) time.sleep(self._retry_wait) + except Exception, e: + logerr("exception in netatmo-client: %s" % e) + weeutil.weeutil.log_traceback('*** ', syslog.LOG_DEBUG) else: logerr("failed to get data after %d attempts" % self._max_tries) @@ -356,7 +360,9 @@ class CloudClient(Collector): @staticmethod def extract_data(x, units_dict): """Extract data we care about from a device or module""" - data = {'time_utc': x['dashboard_data']['time_utc']} + data = dict() + if 'time_utc' in x['dashboard_data']: + data['time_utc'] = x['dashboard_data']['time_utc'] for n in CloudClient.META_ITEMS: if n in x: data[n] = x[n] diff --git a/changelog b/changelog index 9975c63..5e81b33 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +0.12 11sep2018 +* deal with missing time_utc from server + 0.11 08jul2018 * explicitly catch socket timeouts since URLError does not in python 2.7 diff --git a/install.py b/install.py index d004be7..c73ad6f 100644 --- a/install.py +++ b/install.py @@ -10,7 +10,7 @@ def loader(): class NetatmoInstaller(ExtensionInstaller): def __init__(self): super(NetatmoInstaller, self).__init__( - version="0.11", + version="0.12", name='netatmo', description='Driver for netatmo weather stations.', author="Matthew Wall",