ItemRegistryTrigger not working

Tags: #<Tag:0x00007f6173ce0ff0> #<Tag:0x00007f6173ce0f28> #<Tag:0x00007f6173ce0d48>

I have this example code:

from core.rules import rule
from core.triggers import StartupTrigger, ItemRegistryTrigger
from core.log import logging, LOG_PREFIX

log = logging.getLogger(LOG_PREFIX + ".hello.log")     

@rule("test trigger", description="just for test")
class ExampleExtensionRule(object):
    def __init__(self):
        self.triggers = [StartupTrigger("START").trigger,
                         ItemRegistryTrigger("ItemAddedEvent").trigger,
                         ItemRegistryTrigger("ItemRemovedEvent").trigger,
                         ItemRegistryTrigger("ItemUpdatedEvent").trigger]

    def execute(self, module, inputs):
        log.info('*** TRIGGER ***')

When loading the StartupTrigger is not firing and when items are updated also nothing happens.
When removing all 3 ItemRegistryTriggers, the StartupTrigger fires.

What am I doing wrong here?

You are using the extensions rather than using the decorators (still :stuck_out_tongue:).

However, this issue is due to a bug in OSGIEventTrigger that has been around since a breaking change in S1319. This also effects DirectoryEventTrigger. I will fix this in the helper libraries (I may have already :thinking:) or implement these triggers in the NGRE (they are currently only available in the Jython helper libraries).

Yes, Yes and Yes. Decorations are remembering me too much on old DSL and these are not good memories.
And the decorations at the current state do not support ItemRegistryTrigger at all, do they?

Looking at openhab-helper-libraries/Core/automation every I do not see any new commits in the past few months.
Am I looking at the wrong place?

No, they don’t… and neither do the extensions.

Yes… I have many many commits in my local repo that I have not pushed. My spare time is going to the JythonScriptEngineFactory and a separate bundle for the helper libraries. But before these get merged, I will update the helper libraries with my changes.