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

Add XOR ArithmeticGroupFunction #4386

Merged

Conversation

fabianvo
Copy link
Contributor

Resolve #4385

PR provides a simple implementation for XOR. It uses "1 of n" for n > 2 (n = item count in group).

@fabianvo fabianvo requested a review from a team as a code owner September 19, 2024 17:36
@wborn wborn changed the title #4385 add XOR ArithmeticGroupFunction Add XOR ArithmeticGroupFunction Sep 21, 2024
@@ -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
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to XOR

Comment on lines 217 to 218
* 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'.
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

@kaikreuzer kaikreuzer left a 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?

@kaikreuzer kaikreuzer added the enhancement An enhancement or new feature of the Core label Sep 25, 2024
@fabianvo
Copy link
Contributor Author

I also created a minor PR for the documentation update. Hope it is sufficient.

Copy link
Member

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@kaikreuzer kaikreuzer merged commit a5c488d into openhab:main Sep 26, 2024
5 checks passed
@kaikreuzer kaikreuzer added this to the 4.3 milestone Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature of the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add XOR ArithmeticGroupFunction
2 participants