From 0fe255436e29d6d27716ebff58fa54028a228f4d Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 24 Sep 2019 01:20:14 +0200 Subject: [PATCH] Don't fail hard if the seconds key is not in the map --- platypush/plugins/gpio/sensor/motion/pwm3901.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platypush/plugins/gpio/sensor/motion/pwm3901.py b/platypush/plugins/gpio/sensor/motion/pwm3901.py index 97ccb890..6398142c 100644 --- a/platypush/plugins/gpio/sensor/motion/pwm3901.py +++ b/platypush/plugins/gpio/sensor/motion/pwm3901.py @@ -114,7 +114,7 @@ class GpioSensorMotionPwm3901Plugin(GpioSensorPlugin): 'motion_x': x, 'motion_y': y, 'motion_mod': math.sqrt(x * x + y * y), - 'motion_events_per_sec': self._events_per_sec[secs], + 'motion_events_per_sec': self._events_per_sec.get(secs, 0), }