where the first argument to get is the binding, the second argument is the Thing ID, and then you call the method of the argument with the proper arguments.
To my knowledge this has not changes in OH 3, but I don’t know if the Helper Libraries are ported to OH 3 or not.
I didn’t know about the openhab-scripters page.
After following installation instructions for Javascript I’ve been able to import the logger and all worked correctly.
The action parts required some more time because I had some error in the action definition, but after putting all the annotations it worked correctly.
One doubt I have, is about the static methods for the addon actions. I hadn’t defined any and it works. The statics are only needed for compatibility with old rule engine / scripts?
you don’t even need an explicit Java.type in this case with Nashorn (you might prefer including it for clarity though), so this works:.
var logger = org.slf4j.LoggerFactory.getLogger("org.openhab.model.script.Rules");
logger.info("hey!");
For debugging (temporary!) purposes you can also simply use something like print(actions);, this will output something in the console (not in the log) like:
Looking at the code of this class in openhab-core’s code, we can gather it has indeed a get method requiring a scope and a thingUID - that’s how I figure out what’s accessible in the default scope: