Sorry, getting a little confused here:
Is it the right approach?
.things
Thing exec:command:apc [command="python /etc/openhab2/scripts/led.py %2$s", interval=0, timeout=5, autorun=true]
.items
String yourcommand_Args {channel="exec:command:apc:input"}
Switch python_test {channel="exec:command:apc:run"}
.rules
rule “Your Execution”
when
Item python_test changed
then
if(python_test.state == ON)
{
yourcommand_Args.sendCommand(IFWI)
}
end
This doesn’t work
PS: IFWI is the argument which I want to pass!
rlkoshak
(Rich Koshak)
22
There is a near infinity that could be “This doesn’t work”. Logs?
Looking at the code you have a misunderstanding how the Channels work. There are two ways to kick off a shell script.
- Send an ON command to the Item linked to the run Channel
- Send a String command to the Item linked to the input Channel
You are doing both.
Remove the link to the run Channel in python_test.
What is IFWI? A global String variable? If not and it’s an Item you need to use IFWI.state.toString.