Hi all, I was starting with OH 2.0 and I have a lot of rules in my .rules textual file.
One example for all
rule "OU_Outside_Recess"
when
Item OU_Outside_Recess received command
then
strVal = "none"
switch(receivedCommand)
{
case ON: strVal = "1"
case OFF:strVal = "0"
default: logError("OU_Outside_Recess","*** INVALID CMD")
}
if(strVal != "none")
{
executeCommandLine(scriptFullPath, RAMP_RECESS_SPOTLIGHT, strVal)
}
end
where:
OU_Outside_Recess
is a Text itemscriptFullPath
is defined on top of .rules file
val String scriptFullPath = "/etc/openhab/scripts/myOwnBashScript.sh"
RAMP_RECESS_SPOTLIGHT
is defined on top of .rules file
var String RAMP_RECESS_SPOTLIGHT = "20"
myOwnBashScript.sh
is
#!/bin/bash
set -u
itemId=$1
itemVal=$2
…foo…exit 0
I want to have the rule and the script in UI, removing the .sh and the .rules.
How can I do that?
I started a new rule
adding a “script” action

And now?