Broken jython reflection on openhab 3.4.0 GA

I have a problem, running my jython scripts with openhab 3.4.0 GA (docker container) …

from org.openhab.core.persistence.extensions import PersistenceExtensions
from org.openhab.core.items import Item
from org.slf4j import LoggerFactory

log = LoggerFactory.getLogger("jsr223.jython")

x = itemRegistry.getItem("pIndoor_Plant_Sensor_Main_Info")
log.info(u"{}".format(x.__class__))
log.info(u"{}".format(isinstance(x, Item)))
PersistenceExtensions.lastUpdate(x)

produces the following error messages

2022-12-19 10:35:34.932 [INFO ] [jsr223.jython                       ] - <type 'org.openhab.core.library.items.StringItem'>
2022-12-19 10:35:34.933 [INFO ] [jsr223.jython                       ] - 1
2022-12-19 10:35:34.933 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/openhab/conf/automation/jsr223/_test.py': TypeError: lastUpdate(): 1st arg can't be coerced to org.openhab.core.items.Item in /openhab/conf/automation/jsr223/_test.py at line number 15

anyone has an idea?

I tried to reproduce it with a simplified fresh setup and there it works.

Will let you know if I have more findings.

looks like an additional restart of openhab was solving all my problems :slight_smile:

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.