OK, so that example is Rules DSL. Unfortunately, for now at least, if you see an example and it doesn’t explicitly state that it’s a given rules language, assume it’s Rules DSL.
One of the best places to look for examples of Nashorn JavaScript is the Helper Libraries: GitHub - CrazyIvan359/openhab-helper-libraries at js-rewrite
Looking at the JSR223 docs shows:
actions
| Instance oforg.openhab.core.thing.binding.ThingActions
as one of the variables that is injected into the rule. Since you are after a Thing Action this should catch your eye.
So instead of getAction
try actions.getAction()
. I believe that will work.
If you are looking to add new Blockly blocks, also pay special attention to the examples already posted in the marketplace, for example Telegram Actions. That should give you a good template for how to create your blocks.