File or directory not found when running executeCommandLine

  • Platform information:
    • Hardware: Raspi 4 with 8 gigs of RAM
    • OS: Openhabian version 1.6.3
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version: 3
      I’ve recently upgraded to openhab 3 and so far I haven’t had any issues recreating my old rules, but I’ve run into an issue with one of the simpler ones.
      In openhab 2 I had a simple rule created inside visual studio code that never had any issues.
      rule “light switch”
      when
      Item LightSwitch changed to ON
      then
      executeCommandLine(“iono@@o1@@close”)
      end

as far as I can tell Blockly isn’t adequate for this rule so I’ve been trying to run it using a script in the Rule DSL format. From all of the other threads that I’ve read so far it seems like all I have to have in the script is:
executeCommandLine(“iono o1 close”)

Unfortunately the command never runs correctly and my log throws up 50+ lines of issues always starting with:
2021-02-02 03:26:19.494 [WARN ] [rg.openhab.core.io.net.exec.ExecUtil] - Error occurred when executing commandLine ‘[iono o1 close]’

java.io.IOException: Cannot run program “iono o1 close”: error=2, No such file or directory

I’ve logged into the console via SSH and the command runs with no issues at all so I’m hoping someone could point me in the right direction towards what I’m doing wrong

I don’t use openhabian, but I assume that this is the same issue you see in using executeCommandLine in any linux. Depending on how OH is running, the command is probably executing in an environment that doesn’t have access to the system’s path settings. That means it doesn’t know where to look for the iono command. Try giving it the full path to the iono binary. I assume this is one of those iono pi devices, I’ve never used one, so I don’t know what the full path actually is.

That’s because the syntax for executeCommandLine has changed in OH3, per the release notes. @@ no longer works.

executeCommandLine(“iono","o1","close”)

1 Like

Thank you so much, that worked perfectly and now command runs without issues.
I had seen that you were no longer supposed to use @@ for blank spaces but I somehow missed that each part of the command should be in it’s own quotes.