Can a rule have a generic trigger I.E. all Items linked to a chanele trigger on item change?

Trigger a rule by all items having a channel linked

Background Information on the Question:

I’m currently experimenting AI rules for my house automation.

My basic approche is,

  • All “Input” (Numeric, Contact) Items that have a linked channels are suppost to become AI Nodes.
  • any state Update on such an item will trigger the neuronal network

So I’m implementing a Group trigger, add all items to a group “AiNodeGroupe” and add al items with a channel to this group.

Any changes to Items (add, change, etc) will have to match the pattern and chance of not working after changes ar high.

Is there a simple solution like?
triggers: [triggers.AllItemsLinked],

rules.JSRule({
  name: "AiNodeChanged",
  description: "the value of an ai node has changed",
  triggers: [triggers.GroupStateChangeTrigger('aiNodeGroups') ],
  execute: (event) => {
    console.info("AI Node changed", "Executed: " + event.itemName);
  },
  tags: ["AI", "Node"],
  id: "AiNodeChange"
});

Thanks

It’s not in the docs because it’s more of a building block than something that end users would normally be using. But there is a GenericEventTrigger.

But be aware that this can be triggered on any and all OH events: thing status changes, channel events, rules running or going to idle, Items being created, loaded, system runlevels, etc. Bring up the developer sidebar and open the event stream. Everything you see there can be used to trigger a rule.

To use this trigger successfully, you’ll need to have an intimate knowledge of the event bus, event topic structure, and different data that is available for each type of event. See Event Bus | openHAB.

For an example of it’s use, in the UI but you should be able to translate it to a JSRule trigger using the links from above, see Thing Status Reporting [4.0.0.0;4.9.9.9] which filters on the ThingStatusChanged events.

Thank you, that is what I’ was thinking of. With your warnings I’ think it is best to stay using the group trigger.

Site Note:
I’ need to dokument my doing, do you think i can document it as tutoral or schould I’ keep it privat within my own (local) documentation?

Thanks agai for the answer
Ernst

That’s up to you. If you want to share what you’ve done and how to do it please, by all means post it as a tutorial.