Skip tolerance check whether if the new or the old value are not numeric

This commit is contained in:
Fabio Manganiello 2019-08-14 22:49:18 +02:00
parent 4a34fcd7fd
commit 8462f474f7

View file

@ -123,6 +123,7 @@ class SensorBackend(Backend):
try:
v = float(v)
old_v = float(self.data.get(k))
except (TypeError, ValueError):
isNaN = True
@ -136,7 +137,7 @@ class SensorBackend(Backend):
pass
if tolerance is None or isNaN or \
abs(v - self.data.get(k)) >= tolerance:
abs(v - old_v) >= tolerance:
ret[k] = v
return ret