diff --git a/platypush/plugins/gpio/sensor/motion/pwm3901.py b/platypush/plugins/gpio/sensor/motion/pwm3901.py index 6398142c37..4d62e7ee44 100644 --- a/platypush/plugins/gpio/sensor/motion/pwm3901.py +++ b/platypush/plugins/gpio/sensor/motion/pwm3901.py @@ -94,12 +94,12 @@ class GpioSensorMotionPwm3901Plugin(GpioSensorPlugin): sensor = self._get_sensor() - 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) + while True: + try: + x, y = sensor.get_motion() + break + except RuntimeError as e: + time.sleep(0.01) secs = int(time.time()) if (x, y) != (self.x, self.y):