added logging for unknown exceptions in client. deal with missing utc times.

master
Matthew Wall 6 years ago
parent 4f78f1e41e
commit cfd721636e

@ -40,9 +40,10 @@ import weewx.drivers
import weewx.engine import weewx.engine
import weewx.units import weewx.units
import weewx.wxformulas import weewx.wxformulas
import weeutil.weeutil
DRIVER_NAME = 'netatmo' DRIVER_NAME = 'netatmo'
DRIVER_VERSION = "0.11" DRIVER_VERSION = "0.12"
INHG_PER_MBAR = 0.0295299830714 INHG_PER_MBAR = 0.0295299830714
MPH_TO_KPH = 1.60934 MPH_TO_KPH = 1.60934
@ -323,6 +324,9 @@ class CloudClient(Collector):
logdbg("waiting %s seconds before retry" % logdbg("waiting %s seconds before retry" %
self._retry_wait) self._retry_wait)
time.sleep(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: else:
logerr("failed to get data after %d attempts" % logerr("failed to get data after %d attempts" %
self._max_tries) self._max_tries)
@ -356,7 +360,9 @@ class CloudClient(Collector):
@staticmethod @staticmethod
def extract_data(x, units_dict): def extract_data(x, units_dict):
"""Extract data we care about from a device or module""" """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: for n in CloudClient.META_ITEMS:
if n in x: if n in x:
data[n] = x[n] data[n] = x[n]

@ -1,3 +1,6 @@
0.12 11sep2018
* deal with missing time_utc from server
0.11 08jul2018 0.11 08jul2018
* explicitly catch socket timeouts since URLError does not in python 2.7 * explicitly catch socket timeouts since URLError does not in python 2.7

@ -10,7 +10,7 @@ def loader():
class NetatmoInstaller(ExtensionInstaller): class NetatmoInstaller(ExtensionInstaller):
def __init__(self): def __init__(self):
super(NetatmoInstaller, self).__init__( super(NetatmoInstaller, self).__init__(
version="0.11", version="0.12",
name='netatmo', name='netatmo',
description='Driver for netatmo weather stations.', description='Driver for netatmo weather stations.',
author="Matthew Wall", author="Matthew Wall",

Loading…
Cancel
Save