Hello,
I have an issue with a string query with OH 3 RC1.
Short
if (OKExecute==“OK”) query is entered with OH 2.5 (this is what I want)
but NOT entered with OH 3.
Please tell what I’m doing wrong - THX.
Please have a look at the details
Details
OH 2.5.10
pi@raspberrypi:~ $ java -version
openjdk version “1.8.0_152”
OpenJDK Runtime Environment (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 1.8.0_152-b76)
OpenJDK Client VM (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 25.152-b76, mixed mode, Evaluation)
rule “Test1”
when
Item TestSwitch1 changed to ON
then
logInfo("Log","test rule start" )
var String OKExecute=executeCommandLine("/opt/openhab2/conf/scripts/lock122.sh", 100)
logInfo("Log","OKExecute Value 1 " + OKExecute)
if (OKExecute=="OK")
{
logInfo("Log","OKExecute Value 2 " + OKExecute)
}
logInfo("Log","test rule end" )
sendCommand(TestSwitch1, OFF)
end
pi@raspberrypi:~ $ cat /opt/openhab2/conf/scripts/lock122.sh
mkdir /tmp/lock122 && [ -d “/tmp/lock122” ] && echo “OK”
tail openhab.log
2020-12-19 10:20:11.987 [INFO ] [g.eclipse.smarthome.model.script.Log] - test rule start
2020-12-19 10:20:12.050 [INFO ] [g.eclipse.smarthome.model.script.Log] - OKExecute Value 1 OK
2020-12-19 10:20:12.054 [INFO ] [g.eclipse.smarthome.model.script.Log] - OKExecute Value 2 OK //the if query WAS entered
2020-12-19 10:20:12.057 [INFO ] [g.eclipse.smarthome.model.script.Log] - test rule end
OH 3.0.0.RC1 - Milestone Build
pi@raspberrypi:~ $ java -version
openjdk version “11.0.9.1” 2020-11-06 LTS
OpenJDK Runtime Environment Zulu11.43+100-CA (build 11.0.9.1+1-LTS)
OpenJDK Client VM Zulu11.43+100-CA (build 11.0.9.1+1-LTS, mixed mode)
rule “Test1”
when
Item TestSwitch1 changed to ON
then
logInfo("Log","test rule start" )
var String OKExecute = executeCommandLine(Duration.ofSeconds(1),"/opt/openhab/conf/scripts/lock122.sh")
logInfo("Log","OKExecute Value 1 " + OKExecute)
if (OKExecute=="OK")
{
logInfo("Log","OKExecute Value 2 " + OKExecute)
}
logInfo("Log","test rule end" )
sendCommand(TestSwitch1, OFF)
end
pi@raspberrypi:~ $ cat /opt/openhab/conf/scripts/lock122.sh
mkdir /tmp/lock122 && [ -d “/tmp/lock122” ] && echo “OK”
tail openhab.log
2020-12-19 10:32:01.700 [INFO ] [org.openhab.core.model.script.Log ] - test rule start
2020-12-19 10:32:01.735 [INFO ] [org.openhab.core.model.script.Log ] - OKExecute Value 1 OK //the if query WAS NOT entered
2020-12-19 10:32:01.743 [INFO ] [org.openhab.core.model.script.Log ] - test rule end
Many THX for your help
Klaus