Shorter default poll_seconds (0.01) for better motion sensitivity

This commit is contained in:
Fabio Manganiello 2019-09-24 00:10:17 +02:00
parent 63d222d2ee
commit 3da6c41f21
1 changed files with 6 additions and 0 deletions

View File

@ -11,6 +11,8 @@ class SensorMotionPwm3901Backend(SensorBackend):
* ``pwm3901`` (``pip install pwm3901``) * ``pwm3901`` (``pip install pwm3901``)
""" """
_default_poll_seconds = 0.01
def __init__(self, absolute=True, relative=True, **kwargs): def __init__(self, absolute=True, relative=True, **kwargs):
""" """
:param absolute: Enable absolute motion sensor events (default: true) :param absolute: Enable absolute motion sensor events (default: true)
@ -26,6 +28,10 @@ class SensorMotionPwm3901Backend(SensorBackend):
'motion_abs_mod': absolute, '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) super().__init__(plugin='gpio.sensor.motion.pwm3901', enabled_sensors=enabled_sensors, **kwargs)