Don't fail hard in case of temporary sensor glitches

This commit is contained in:
Fabio Manganiello 2019-09-24 01:01:06 +02:00
parent d6de1189e5
commit ff1fe3058b
1 changed files with 7 additions and 1 deletions

View File

@ -89,7 +89,13 @@ class GpioSensorMotionPwm3901Plugin(GpioSensorPlugin):
"""
sensor = self._get_sensor()
x, y = sensor.get_motion()
try:
x, y = sensor.get_motion()
except RuntimeError as e:
self.logger.warning('Unable to retrieve sensor data: {}'.format(e))
self._sensor = None
return {}, str(e)
return {
'motion_x': x,