Don't fail hard in case of temporary sensor glitches
This commit is contained in:
parent
d6de1189e5
commit
ff1fe3058b
1 changed files with 7 additions and 1 deletions
|
@ -89,7 +89,13 @@ class GpioSensorMotionPwm3901Plugin(GpioSensorPlugin):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
sensor = self._get_sensor()
|
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 {
|
return {
|
||||||
'motion_x': x,
|
'motion_x': x,
|
||||||
|
|
Loading…
Reference in a new issue