Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[basicprofiles] Fix inability to filter a percent QuantityType input #18091

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jimtng
Copy link
Contributor

@jimtng jimtng commented Jan 11, 2025

Normally to filter the values of QuantityType inputs, the conditions are written as > min_value, e.g. > 100 W. However, when the QuantityType is a percent, writing it as > 10 % caused the statefilter parser to think it's a $DELTA_PERCENT check instead of checking the actual input value.

This is a bug and a problem, preventing the state filter from being used to filter a percent quantity type.

This PR fixes this problem by adding a new $INPUT function which can be used in this situation to help the parser, so the condition needs to be rewritten as $INPUT > 10 % to achieve "input-value-filter" instead of "delta-percent-filter".

This should be backported to 4.3

@jimtng jimtng requested a review from J-N-K as a code owner January 11, 2025 13:35
@jimtng jimtng added the bug An unexpected problem or unintended behavior of an add-on label Jan 11, 2025
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/state-filter-range-filter-profile/158025/43

@jimtng jimtng force-pushed the statefilter-input branch from e31c9f6 to d116107 Compare January 11, 2025 23:44
@jimtng jimtng force-pushed the statefilter-input branch from d116107 to 402f179 Compare January 11, 2025 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants