Usage of new ECMA2021 Automation Scripting (GraalVM)

@jpg0 I got it now to run, things I did:

  1. Installed ohj-support Add-on from https://github.com/jpg0/oh-config/files/5745369/org.openhab.automation.ohj-support-3.0.0-SNAPSHOT.jar.zip
  2. A fresh git clone of GitHub - jpg0/ohj: Openhab Javascript Library into “/etc/openhab/automation/lib/javascript/community”
  3. Changed the mentioned function “lookupService” to the fixed one Testing the GraalJS package with OH3 · Issue #2 · jpg0/oh-config · GitHub

After a restart it worked.

What I am wondering is that I do have to use always relative paths for loading the ohj package via require:

const { item, sendIt } = require("../../../lib/javascript/community/ohj/fluent/fluent");
const ohj = require("./../../../lib/javascript/community/ohj");
const LOG = ohj.log("second");
const fluent = ohj.fluent;

with (fluent) {
    when(cron("0/30 * * * * ?")).then(sendOff().toItem("RemoteopenHABServerPROD_ItemSFStudioLichtDecke"));
}

When I am going through your personal git repo you always use “…require(‘ohj’);”.

Why is that not working on my setup?

Also I am wondering if there is something like the “event.itemState” property like it is available in the definition of “classic” oh scripters ECMA5 rules (when using JSRule with ohj)?

Thank you very much for your help!