Item Object Interface Documentation

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.

Thanks.

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.

Thanks Rich.

Unfortunately I am not a big fan of the Xtend language so I am writing my rules in JavaScript hence the designer will not provide me with that functionality (I assume).

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?

Thanks again.

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:

openhab-core/bundles/org.openhab.core.compat1x/src/main/java/org/openhab/core/library/items/

Path to Item.java Interface:

openhab-core/bundles/org.openhab.core.compat1x/src/main/java/org/openhab/core/items/Item.java

Path to Generic Item:

openhab-core/bundles/org.openhab.core.compat1x/src/main/java/org/openhab/core/items/GenericItem.java