forked from platypush/platypush
Skip tolerance check whether if the new or the old value are not numeric
This commit is contained in:
parent
4a34fcd7fd
commit
8462f474f7
1 changed files with 2 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue