Skip to content

Commit cb250d9

Browse files
committed
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>
1 parent 3317825 commit cb250d9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/filter/PersistenceThresholdFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public boolean apply(Item item) {
104104
}
105105
} else if (!unit.isBlank()) {
106106
// consider unit only if not relative threshold
107-
delta = delta.toUnit(unit);
107+
delta = delta.toUnitRelative(unit);
108108
if (delta == null) {
109109
throw new UnconvertibleException("");
110110
}

0 commit comments

Comments
 (0)