Error creating an ItemAddedTrigger

Dear Community,

I try to create an ItemAddedTrigger with the following script

# jython imports
import traceback

# openhab-helper-libraries imports
import core.items
from core.log import logging, LOG_PREFIX
from core.triggers import ItemAddedTrigger

MODULE_NAME = "itemAddedTrigger_test"

log = logging.getLogger("{}.{}".format(LOG_PREFIX, MODULE_NAME))

def scriptLoaded(id):"{}.py".format(MODULE_NAME))
        trigger = [ItemAddedTrigger().trigger]

Unfortunately, this code produces the following log output:

06:05:53.172 [INFO ] [ort.internal.loader.ScriptFileWatcher] - Loading script 'python/personal/'
06:05:53.208 [INFO ] [jsr223.jython.itemAddedTrigger_test  ] -
06:05:53.222 [ERROR] [jsr223.jython.itemAddedTrigger_test  ] - Traceback (most recent call last):
  File "<script>", line 23, in scriptLoaded
  File "/etc/openhab2/automation/lib/python/core/", line 299, in __init__
    ItemRegistryTrigger.__init__(self, "ItemAddedEvent")
  File "/etc/openhab2/automation/lib/python/core/", line 288, in __init__
  File "/etc/openhab2/automation/lib/python/core/osgi/", line 106, in __init__
    """Filter is a predicate taking an event argument and returning True (keep) or False (drop)"""
TypeError: org.python.proxies.core.triggers$ItemAddedTrigger$28(): expected 0 args; got 3

06:05:53.223 [DEBUG] [ort.internal.loader.ScriptFileWatcher] - Script loaded: python/personal/

openHAB 2.4.0 Release, Jython 2.7.0, openhab-helper-libraries,

Thank you for any hint in advance!

I just saw this post:

Custom handlers (DirectoryTriigger, OSGIEventTrigger, StartupTrigger) will only work in S1566 and newer.

which might explain, why it is not working.

You got it, but the OsgiEventTrigger is also broken. I’ve already corrected this and included the ItemRegistry triggers into the when decorator. PR will be committing soon.

An alternative is to use the GenericEventTrigger and use ItemAddedEvent for the eventTopic.