-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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] Add additional comparisons to State Filter profile #17323
Conversation
ecb7cac
to
4d382a7
Compare
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/state-filter-profile/158025/1 |
be83319
to
d68a005
Compare
- Fix bug where undefined `mismatchState` passed `UNDEF` instead of ignoring state updates - Support multiline conditions - Support comparing against the input state from handler to filter out unwanted data Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
d68a005
to
ed2b1c7
Compare
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
Unquoted identifiers can refer to other items or have other meanings. Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general: nice addition.
@@ -27,13 +27,13 @@ Switch lightsStatus { | |||
|
|||
The Generic Toggle Switch Profile is a specialization of the Generic Command Profile and toggles the State of a Switch Item whenever one of the specified events is triggered. | |||
|
|||
### Configuration | |||
### Generic Toggle Switch Profile Configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change that? Isn't this already clear by the structure (##
denotes the profile, ###
the section within that profile)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I followed the markdown warning that the headings should be unique.
- This makes the anchor links better, but it's a very obscure benefit perhaps. Without this, the links would look like
#configuration-1
,#configuration-2
, etc.
Should I revert this?
|
||
- The operator names must be surrounded by spaces, i.e.: `Item EQ 10` | ||
- The operator symbols do not need to be surrounded by spaces, e.g.: `Item==10` and `Item == 10` are both fine. | ||
- Only symbolic operators can be used when comparing against the incoming state, e.g. `> 10`. Using operator names isn't supported, i.e. this is not supported: ~~`GT 10`~~. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex is more complicated to support it, but I've redone it now. Is it worth the extra complexity?
.../src/main/java/org/openhab/transform/basicprofiles/internal/profiles/StateFilterProfile.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/openhab/transform/basicprofiles/internal/profiles/StateFilterProfile.java
Outdated
Show resolved
Hide resolved
} | ||
} | ||
|
||
rhs = Objects.requireNonNull(parsedValue instanceof StringType ? parsedValue.toString() : parsedValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need Objects.requireNonNull
here? If parsedValue==null
you exit in the if-clause above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compiler complained about null mismatch further down in the calls to compareTo(rhs)
.
.../src/main/java/org/openhab/transform/basicprofiles/internal/profiles/StateFilterProfile.java
Show resolved
Hide resolved
.../src/main/java/org/openhab/transform/basicprofiles/internal/profiles/StateFilterProfile.java
Outdated
Show resolved
Hide resolved
a41d781
to
a93556c
Compare
16aa71f
to
4d878eb
Compare
support named operator for input checking Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
4d878eb
to
00035da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Nice to see so many tests.
…penhab#17323) * Add inequality comparisons to State Filter profile - Fix bug where undefined `mismatchState` passed `UNDEF` instead of ignoring state updates - Support multiline conditions - Support comparing against the input state from handler to filter out unwanted data * Support comparing item to item or input to item Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
…penhab#17323) * Add inequality comparisons to State Filter profile - Fix bug where undefined `mismatchState` passed `UNDEF` instead of ignoring state updates - Support multiline conditions - Support comparing against the input state from handler to filter out unwanted data * Support comparing item to item or input to item Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au> Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
…penhab#17323) * Add inequality comparisons to State Filter profile - Fix bug where undefined `mismatchState` passed `UNDEF` instead of ignoring state updates - Support multiline conditions - Support comparing against the input state from handler to filter out unwanted data * Support comparing item to item or input to item Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
…penhab#17323) * Add inequality comparisons to State Filter profile - Fix bug where undefined `mismatchState` passed `UNDEF` instead of ignoring state updates - Support multiline conditions - Support comparing against the input state from handler to filter out unwanted data * Support comparing item to item or input to item Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
==
,!=
, etc.mismatchState
passedUNDEF
instead of ignoring state updatesunwanted data
https://community.openhab.org/t/state-filter-range-filter-profile/158025