Index for triggeringItem?

Hello all,

I’d like to maintain an array of counters, where each counter corresponds to a triggeringItem in a group.

Code completion is not working in VS Code, so I have no idea what functions are available for triggeringItem. Is there something available that will work?

A second, broader question is: Is there a document that describes OpenHAB’s language in it’s entirety, with, for example, an entry for triggeringItem that shows all of it’s functions?

triggeringItem is an Item. It has the same methods and properties as any other Item. Those that are relevant to Rules are documented at https://www.openhab.org/docs/configuration/rules-dsl.html#manipulating-item-states and https://www.openhab.org/docs/configuration/persistence.html#persistence-extensions-in-scripts-and-rules (Persistence).

The short answer is no, there isn’t. We have https://www.openhab.org/docs/configuration/rules-dsl.html (follow the links on that page too) which documented Rules DSL. And there is a section that talks about what triggeringItem is (an implicit variable that contains the Item that caused the Rule to run). For information about the various Java Objects that might be used in an openHAB Rule, such as GenericItem see the JavaDocs: https://www.openhab.org/javadoc/v2.5.

If using Jython, JavaScript or Groovy to develop rules, see https://openhab-scripters.github.io/openhab-helper-libraries/index.html

Documentation for building Rules through the REST API (e.g. through PaperUI) do not really exist but the first steps to document that for OH 3 is happening at [wiki] Getting Started with OH3: rewriting the tutorial - 9. Make everything work together: rules (advanced)

OK thanks, so I could use a Map<> to store a count for each item in a group. But if I wanted to use an array, I would need an integer index of the triggeringItem within the group. Does this exist?

Honestly, this smells like an XY Problem. What is it you are really trying to achieve? What are you wanting to do with this count?