Commit 20610fb
authored
Fix persistence threshold filter with UoM (#4881)
* Add tests with UoM conversion
For `PersistenceThresholdFilter` add a test case that fails when
using temperatures in °C and a threshold in Kelvin. The threshold
should ignore the offset (0 °C = 273,15 K).
Add another test with length to increase coverage.
Signed-off-by: Christoph Gehrke <cgdev@duck.com>
* Fix PersistenceThresholdFilter UoM conversion
Use `toUnitRelative()` instead of `toUnit()` for delta (the difference
of old and current state). In particular for temperatures an offset
of different units (like °C and K) should be ignored when considering
the delta.
Signed-off-by: Christoph Gehrke <cgdev@duck.com>
---------
Signed-off-by: Christoph Gehrke <cgdev@duck.com>1 parent cc95a6d commit 20610fb
2 files changed
Lines changed: 5 additions & 1 deletion
File tree
- bundles/org.openhab.core.persistence/src
- main/java/org/openhab/core/persistence/filter
- test/java/org/openhab/core/persistence/filter
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
105 | 109 | | |
106 | 110 | | |
107 | 111 | | |
| |||
0 commit comments