Skip to content

Commit

Permalink
Ignore empty sensor readings
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Mar 7, 2019
1 parent 60ce44b commit 1dd565c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion terkin/datalogger.py
Expand Up @@ -77,7 +77,9 @@ def read_sensors(self):
sensor_name = sensor.__class__.__name__
print('INFO: Reading sensor "{}"'.format(sensor_name))
try:
data.update(sensor.read())
reading = sensor.read()
if reading is not None:
data.update(reading)
except Exception as ex:
print('ERROR: Reading sensor "{}" failed: {}'.format(sensor_name, ex))
return data
Expand Down

0 comments on commit 1dd565c

Please sign in to comment.