# HG changeset patch # User drewp@bigasterisk.com # Date 1545990993 28800 # Node ID 38a74c43639cb514e97d0ff24502d88be868f814 # Parent f78438913bf7f3b6e10135fc7f4c06bda4c010a8 defer import of w1thermsensor Ignore-this: 9fcf8a4313599bace8315f943c145f41 diff -r f78438913bf7 -r 38a74c43639c service/piNode/devices.py --- a/service/piNode/devices.py Tue Dec 18 23:56:12 2018 -0800 +++ b/service/piNode/devices.py Fri Dec 28 01:56:33 2018 -0800 @@ -18,7 +18,6 @@ import pigpio except ImportError: pigpio = None -import w1thermsensor try: import rpi_ws281x except ImportError: @@ -359,7 +358,9 @@ # deliberately written like arduinoNode's one for an easier merge. def __init__(self, *a, **kw): DeviceType.__init__(self, *a, **kw) + import w1thermsensor log.info("scan for w1 devices") + self.SensorNotReadyError = w1thermsensor.core.SensorNotReadyError self._sensors = w1thermsensor.W1ThermSensor.get_available_sensors() for s in self._sensors: # Something looks different about these ids @@ -379,7 +380,7 @@ stmts.append((sensor.uri, ROOM['temperatureF'], # see round() note in arduinoNode/devices.py Literal(round(tempF, 2)))) - except w1thermsensor.core.SensorNotReadyError as e: + except self.SensorNotReadyError as e: log.warning(e) return stmts