-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
Add XOR ArithmeticGroupFunction #4386
Add XOR ArithmeticGroupFunction #4386
Conversation
Signed-off-by: Fabian Vollmann <[email protected]>
@@ -35,6 +35,7 @@ | |||
* @author Kai Kreuzer - Initial contribution | |||
* @author Thomas Eichstädt-Engelen - Added "N" functions | |||
* @author Gaël L'hopital - Added count function | |||
* @author Fabian Vollmann - Added ONE function |
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 ONE? Don't you mean XOR?
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.
changed to XOR
* This does a logical 'xor' operation. Only if items are of opposing 'activeState' and | ||
* 'passiveState', 'activeState' is returned. For more than 2 states, this is '1 of n'. |
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.
Only if items are of opposing 'activeState' and 'passiveState', 'activeState' is returned
I do not fully get that statement. Could you try to reformulate it to make it clearer?
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 hope comment is easier to understand now
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, lgtm apart from the two minor comments above.
May I also ask you to prepare a PR for the documentation update at https://github.com/openhab/openhab-docs/blob/main/configuration/items.md#derive-group-state-from-member-items?
Signed-off-by: Fabian Vollmann <[email protected]>
I also created a minor PR for the documentation update. Hope it is sufficient. |
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.
Thank you!
Resolve #4385
PR provides a simple implementation for XOR. It uses "1 of n" for n > 2 (n = item count in group).