Trying to run shell script / rules

Hi,

Still using OH1, but want to ‘migrate’ to OH2. But there is a nasty ‘problem’.
I can’t run a shell script. In log message:
Script execution failed: ReferenceError: “executeCommandLine” is not defined in at line number 1


In OH1 i had to load the “org.openhab.binding.exec-1.8.3.jar” (i’ve tried the 1.8.3 also) but with the ‘exec Binding 2.3.0’ it won’t work.
What am i doing wrong?
b.t.w. the unix script is running fine, so that’s not the problem. Permissions of the script is rwxr-xr-x. user ‘openhab’ can do ‘sudo’ without password. Used an ‘absolute’ path etc. I don’t understand the error?!?

  • Platform information:
    • Hardware: Raspberry B+
    • OS: Stretch, kernel 4.14
    • Java Runtime Environment: 1.8.0_65
    • openHAB version: 2.3.0 (release build)

Binding in use: exec binding 2.3.0, homematic 2.3.0, (als trying to ‘bind’: binding-lgtv1 - 1.12.0) rest of config/setup -> defaults
I can see all my ‘homemtic’ devices and are ‘online’

Bindings are for Items.
Actions are for commands in rules

Have a look around in habmin for addons/actions options

sorry, that document is not helpfull. i’ve discovered, when i copy the old (oh1) xyz.rules file to /etc/openhap2/rules, it seems to work. without the ‘rubbish’ in the ‘rules gui’.
i have no idea how to use the ‘gui’ for this type of actions. i’ve found my ‘xyz.rules’ in the ‘gui’ but i can’t edit it. although the file and directory are ‘writeable’ (for everybody)
the ‘gui’ is a big mystory for me :disappointed_relieved:

I think maybe “rules gui” is referring to the experimental rules engine? This does its own thing, completely unrelated to rules in xxx.rules files. Like it says, it’s experimental and has limitations. I think what you were telling it to do was to execute a script called executeCommandLine, which I shouldn’t think you had in your scripts folder. I have no idea how you would get it to run an actual script, if that’s currently possible.

As you’ve come from a 1.8.3 background, thee is absolutely nothing stopping you from continuing to use xxx.rules files. If your rules are of any complexity, you will probably have to anyway.

There are some changes needed for OH2 - have you seen

Ok, thanks… i will continue to use the xyz,rules files. ( maybe when oh3 is released :grinning: i give it another chance )
About the ‘rules gui’, i mean the ‘editor’ like the attached screenshot at the start of this thread. That ‘jigsaw piece’ editor in habmin is pure horror.
But if the ‘old fashioned style’ stay’s intact, i’am happy

For editing, VSCode extenstion for OH is good. Something else new to learn, of course.

You might get some use out of https://www.openhab.org/docs/configuration/migration/#migration-from-openhab-1-x-to-openhab-2