I would like to know if there is a mechanism by which one could establish to which groups an item belongs. I’ve not been able to find a definitive description of the properties and methods available on the item object and its descendants and, apparently, the source for these are not in the GitHub repository.
I can read the source if its available and a document doesn’t exist.
The source code is indeed in GitHub. But the easiest way to discover what methods are available to you in a Rule is by using Designer, typing the name of an Item and pressing
<ctrl><space>. A dialog will pop up and show all the available methods for an Item.
Now to your specific question. There is a
groupNames method that returns a List of all the groups that Item is a member of.
As for GitHub, I cloned openhab/openhab and greped for (from memory here - I’m not at home) package org.openhab.core and I received no hits. Could you be more specific about the location of the source code for items and derivatives?
Hmmmm. It looks like things have been reorganized or something as part as the transition to OH 2. They used to be in openhab/openhab but it looks like that repo is just bindings now.
You can find these classes in the OH 1 compatibility module for OH 2 in kaikreuzer/openhab-core under
Path to individual Items classes:
Path to Item.java Interface:
Path to Generic Item: