-
Notifications
You must be signed in to change notification settings - Fork 26
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] State filter profile #531
Conversation
0e953b7
to
4511147
Compare
...c/main/java/org/smarthomej/transform/basicprofiles/internal/profiles/StateFilterProfile.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/smarthomej/transform/basicprofiles/internal/profiles/StateFilterProfile.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/smarthomej/transform/basicprofiles/internal/profiles/StateFilterProfile.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/smarthomej/transform/basicprofiles/internal/profiles/StateFilterProfile.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/smarthomej/transform/basicprofiles/internal/profiles/StateFilterProfile.java
Outdated
Show resolved
Hide resolved
| Configuration Parameter | Type | Description | | ||
|-------------------------|------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `conditions` | text | Comma separated list of expressions on the format `ITEM_NAME OPERATOR ITEM_STATE`, ie `MyItem EQ OFF`. Use quotes around `ITEM_STATE` to treat value as string ie `'OFF`' | | ||
| `mismatchState` | text | Optional state to pass instead if conditions are NOT met. Use quotes to treat as `StringType` | |
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 it necessary to quote strings? There is also an issue with the way you split the string. If the comparison value contains a ,
, you split in the middle of a string. I know that this is really hard to handle correctly.
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.
Example why it may be useful (required) to quote strings
I have an aircon with a mode
(string) channel. It takes values such as HEAT
, COOL
, OFF
and so on. In order to not re-create state parsing, I've used the OH TypeParser
. For a value OFF
it will return OnOffType.OFF
, and not the string OFF
.
I guess I could improve further by checking the item type, but that would also make the same syntax mean 2 different things, and my gut feeling is that there will still be situations where the (hypotetical) user would want the non-default functionality.
Regarding comma as separator between multiple expressions; made this configurable.
dd77018
to
9140a9e
Compare
Signed-off-by: Arne Seime <arne.seime@gmail.com>
Signed-off-by: Arne Seime <arne.seime@gmail.com>
Signed-off-by: Arne Seime <arne.seime@gmail.com>
Signed-off-by: Arne Seime <arne.seime@gmail.com>
Signed-off-by: Arne Seime <arne.seime@gmail.com>
Signed-off-by: Arne Seime <arne.seime@gmail.com>
823ebae
to
f8d82ff
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.
Just a few code-style comments, otherwise fine. Can you address those quickly? I would like to include that in the release later this week.
...c/main/java/org/smarthomej/transform/basicprofiles/internal/profiles/StateFilterProfile.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/smarthomej/transform/basicprofiles/internal/profiles/StateFilterProfile.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/smarthomej/transform/basicprofiles/internal/profiles/StateFilterProfile.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/smarthomej/transform/basicprofiles/internal/profiles/StateFilterProfile.java
Outdated
Show resolved
Hide resolved
…rg/smarthomej/transform/basicprofiles/internal/profiles/StateFilterProfile.java
…rg/smarthomej/transform/basicprofiles/internal/profiles/StateFilterProfile.java
…rg/smarthomej/transform/basicprofiles/internal/profiles/StateFilterProfile.java
…rg/smarthomej/transform/basicprofiles/internal/profiles/StateFilterProfile.java
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
* State filter profile Signed-off-by: Arne Seime <arne.seime@gmail.com> Co-authored-by: J-N-K <github@klug.nrw> (cherry picked from commit 6104110) Signed-off-by: Jan N. Klug <github@klug.nrw>
* State filter profile Signed-off-by: Arne Seime <arne.seime@gmail.com> Co-authored-by: J-N-K <github@klug.nrw> (cherry picked from commit 6104110) Signed-off-by: Jan N. Klug <github@klug.nrw>
Simple filter profile to filter unwanted values originating from a Handler - based on some item(s)' state.
Optional support for replacement state to send instead