Fixed wrong bound assignment on values below the lower bound
parent
bb98331ba4
commit
25f7c31911
|
@ -380,7 +380,7 @@ class RangeFilter(Filter):
|
|||
_LOGGER.debug("Lower outlier nr. %s in %s: %s",
|
||||
self._stats_internal['erasures_low'],
|
||||
self._entity, new_state)
|
||||
new_state.state = self._upper_bound
|
||||
new_state.state = self._lower_bound
|
||||
|
||||
return new_state
|
||||
|
||||
|
|
|
@ -141,14 +141,14 @@ class TestFilterSensor(unittest.TestCase):
|
|||
lower_bound=lower,
|
||||
upper_bound=upper)
|
||||
for unf_state in self.values:
|
||||
prev = float(unf_state.state)
|
||||
unf = float(unf_state.state)
|
||||
filtered = filt.filter_state(unf_state)
|
||||
if prev < lower:
|
||||
if unf < lower:
|
||||
self.assertEqual(lower, filtered.state)
|
||||
elif prev > upper:
|
||||
elif unf > upper:
|
||||
self.assertEqual(upper, filtered.state)
|
||||
else:
|
||||
self.assertEqual(prev, filtered.state)
|
||||
self.assertEqual(unf, filtered.state)
|
||||
|
||||
def test_throttle(self):
|
||||
"""Test if lowpass filter works."""
|
||||
|
|
Loading…
Reference in New Issue