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:
|
try:
|
||||||
v = float(v)
|
v = float(v)
|
||||||
|
old_v = float(self.data.get(k))
|
||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
isNaN = True
|
isNaN = True
|
||||||
|
|
||||||
|
@ -136,7 +137,7 @@ class SensorBackend(Backend):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if tolerance is None or isNaN or \
|
if tolerance is None or isNaN or \
|
||||||
abs(v - self.data.get(k)) >= tolerance:
|
abs(v - old_v) >= tolerance:
|
||||||
ret[k] = v
|
ret[k] = v
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
Loading…
Reference in a new issue