Some rules didn't work after migration (executecommandline, python)

Hi all,
Upgraded from 2.5.11 to 3.0 using openhabian.
Everything go smooth except some rules didn’t work.

items:
Number:Dimensionless Analog_Light

Rules:
rule “Dark”
when
Time cron “0 */5 * * * ?” or
then
Analog_Light.postUpdate(executeCommandLine(duration.ofseconds(2),“sudo@@python@@/etc/openhab/python/bh1750.py”))
end

where bh1750.py will return the lux reading from GPIO and it work fine from command line.
The problem is item Analog_Light never got update

Any help or hints are welcome.
Thanks in advance.

Try running that command from a shell script. OH execution does not have a shell environment.

As the openhab user?

arguments of executeCommandLine in OH3 have to be separated parameters.

1 Like

Check here for an example: Jython helper libraries for OH3 - #24 by rkrisi

It did not appear to me they were using the helper libraries.

That makes no difference for the syntax of the executeCommanLine method.

1 Like