diff --git a/bundles/org.openhab.transform.basicprofiles/src/main/java/org/openhab/transform/basicprofiles/internal/profiles/StateFilterProfile.java b/bundles/org.openhab.transform.basicprofiles/src/main/java/org/openhab/transform/basicprofiles/internal/profiles/StateFilterProfile.java index 10ae40488af..4cfb9cd9e03 100644 --- a/bundles/org.openhab.transform.basicprofiles/src/main/java/org/openhab/transform/basicprofiles/internal/profiles/StateFilterProfile.java +++ b/bundles/org.openhab.transform.basicprofiles/src/main/java/org/openhab/transform/basicprofiles/internal/profiles/StateFilterProfile.java @@ -230,6 +230,7 @@ public class StateFilterProfile implements StateProfile { } if (conditions.stream().allMatch(c -> c.check(state))) { + acceptedState = state; return state; } else { return configMismatchState; @@ -344,7 +345,6 @@ public class StateFilterProfile implements StateProfile { } else if (rhsState instanceof FunctionType rhsFunction) { if (acceptedState == UnDefType.UNDEF && (rhsFunction.getType() == FunctionType.Function.DELTA || rhsFunction.getType() == FunctionType.Function.DELTA_PERCENT)) { - acceptedState = input; return true; } rhsItem = getLinkedItem(); @@ -366,7 +366,6 @@ public class StateFilterProfile implements StateProfile { } else if (lhsState instanceof FunctionType lhsFunction) { if (acceptedState == UnDefType.UNDEF && (lhsFunction.getType() == FunctionType.Function.DELTA || lhsFunction.getType() == FunctionType.Function.DELTA_PERCENT)) { - acceptedState = input; return true; } lhsItem = getLinkedItem(); @@ -439,10 +438,6 @@ public class StateFilterProfile implements StateProfile { case LTE -> ((Comparable) lhs).compareTo(rhs) <= 0; }; - if (result) { - acceptedState = input; - } - return result; } catch (IllegalArgumentException | ClassCastException e) { logger.warn("Error evaluating condition: {} in link '{}': {}", this, callback.getItemChannelLink(), diff --git a/bundles/org.openhab.transform.basicprofiles/src/test/java/org/openhab/transform/basicprofiles/internal/profiles/StateFilterProfileTest.java b/bundles/org.openhab.transform.basicprofiles/src/test/java/org/openhab/transform/basicprofiles/internal/profiles/StateFilterProfileTest.java index 301bfb1ee43..7f0b38750de 100644 --- a/bundles/org.openhab.transform.basicprofiles/src/test/java/org/openhab/transform/basicprofiles/internal/profiles/StateFilterProfileTest.java +++ b/bundles/org.openhab.transform.basicprofiles/src/test/java/org/openhab/transform/basicprofiles/internal/profiles/StateFilterProfileTest.java @@ -677,6 +677,10 @@ public class StateFilterProfileTest { Arguments.of(decimalItem, "$DELTA >= 1", decimals, DecimalType.valueOf("10"), true), // Arguments.of(decimalItem, "$DELTA >= 1", decimals, DecimalType.valueOf("5.5"), false), // + // Multiple delta conditions + Arguments.of(decimalItem, "$DELTA >= 1, $DELTA <= 10", decimals, DecimalType.valueOf("15"), true), // + Arguments.of(decimalItem, "$DELTA >= 1, $DELTA <= 10", decimals, DecimalType.valueOf("16"), false), // + Arguments.of(decimalItem, "$DELTA_PERCENT >= 10", decimals, DecimalType.valueOf("4.6"), false), // Arguments.of(decimalItem, "$DELTA_PERCENT >= 10", decimals, DecimalType.valueOf("4.5"), true), // Arguments.of(decimalItem, "$DELTA_PERCENT >= 10", decimals, DecimalType.valueOf("5.4"), false), //