From 74aeca5c340cfd720337a40ff2e8bf53587dfd67 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 15 Apr 2023 01:21:18 +0200 Subject: [PATCH] Trigger a sensor event only if abs(old_data - new_data) > tolerance Not if abs(old_data - new_data) >= tolerance, otherwise events will always be triggered when tolerance=0, even if the data hasn't changed. --- platypush/plugins/sensor/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platypush/plugins/sensor/__init__.py b/platypush/plugins/sensor/__init__.py index 4a126ef110..636dacb30b 100644 --- a/platypush/plugins/sensor/__init__.py +++ b/platypush/plugins/sensor/__init__.py @@ -135,7 +135,7 @@ class SensorPlugin(RunnablePlugin, SensorEntityManager, ABC): else: tolerance = 0 - return abs(old_data - new_data) >= tolerance + return abs(old_data - new_data) > tolerance def _has_changes( self,