-
-
Notifications
You must be signed in to change notification settings - Fork 427
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 #4385
Comments
Signed-off-by: Fabian Vollmann <[email protected]>
I'm curious to learn the use case for this. |
It is somewhat exotic, but could be used for systems with redundancy. For example 2 or more submerged pumps, but only one may be active at any given time. You can then use XOR to at least be notified of multiple devices running concurrently, if there is no automatic fallback on failures. Or a mechanism to have automatic and manual heating/cooling and only allowing one input method, but not both at the same time. In general, XOR is a basic logic operation and currently not available. For my use case, the "1 of n" variant is sufficient, but there are 2 ways of implementing it. The other would be to have the result be true, if an odd number of inputs is true. |
Albrecht JUNG strongly supports this |
Can you show a concrete example (items, rules, or sitemap/ UI) of how exactly you're going to use it? Even if you were to have an "XOR" group function, it seems that you'd still need a rule to process it anyway? Implementing this functionality in a rule is trivial. e.g. in JRuby # For 1-of-n
changed(MyGroup.members) { |event| event.group.update(event.group.members.count(&:on?) == 1) }
# For odd
changed(MyGroup.members) { |event| event.group.update(event.group.members.count(&:on?).odd?) } given the items: Group:Switch MyGroup If it were to be added as a group function, both variants would need to be supported Then eventually someone would say they need XNOR. |
Signed-off-by: Fabian Vollmann <[email protected]>
* #4385 add XOR ArithmeticGroupFunction (1 of n) Signed-off-by: Fabian Vollmann <[email protected]>
It would be nice to be able to XOR (not just AND, OR, NAND, NOR) states.
The text was updated successfully, but these errors were encountered: