From 3da6c41f21b3d2c8e9af477e4a8b69010f035f03 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 24 Sep 2019 00:10:17 +0200 Subject: [PATCH] Shorter default poll_seconds (0.01) for better motion sensitivity --- platypush/backend/sensor/motion/pwm3901.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platypush/backend/sensor/motion/pwm3901.py b/platypush/backend/sensor/motion/pwm3901.py index 271b85cd..401f1297 100644 --- a/platypush/backend/sensor/motion/pwm3901.py +++ b/platypush/backend/sensor/motion/pwm3901.py @@ -11,6 +11,8 @@ class SensorMotionPwm3901Backend(SensorBackend): * ``pwm3901`` (``pip install pwm3901``) """ + _default_poll_seconds = 0.01 + def __init__(self, absolute=True, relative=True, **kwargs): """ :param absolute: Enable absolute motion sensor events (default: true) @@ -26,6 +28,10 @@ class SensorMotionPwm3901Backend(SensorBackend): 'motion_abs_mod': absolute, } + if 'poll_seconds' not in kwargs: + # noinspection PyTypeChecker + kwargs['poll_seconds'] = self._default_poll_seconds + super().__init__(plugin='gpio.sensor.motion.pwm3901', enabled_sensors=enabled_sensors, **kwargs)