- Platform information:
- Hardware: Intel i9 9900 with 32GB of memory
- OS: Arch Linux
- Java Runtime Environment:
Zulu Embedded 8Java 11 OpenJDK - openHAB version: OH3 3.10 Snapshot
- Issue of the topic: Executing command-line from a Rule/Script.
I am creating a rule that is supposed to execute a command when a switch changes status.
I’ve created a switch item to control my Roku. The switch seems to work just fine as it is toggling across all devices and updating.
I created a rule that is supposed to execute a command when the state changes however, nothing happens when I flip the switch.
I have tried creating the rule in /etc/openhab3/rules/home.rules and creating the script on the web UI. Both cases don’t work.
Here is what I have tried in /etc/openhab3/rules/home.rules:
rule "Roku On"
when
Item rokuPower received command ON
then
executeCommandLine(Duration.inSeconds(5), "curl -d '' http://192.168.1.33:8060/keypress/Home")
end
In the rule creator UI web tool, I create the rule like the following:
triggers:
- id: "1"
configuration:
itemName: rokuPower
type: core.ItemStateChangeTrigger
conditions: []
actions:
- id: "2"
configuration:
type: application/javascript
script: executeCommandLine(Duration.inSeconds(5), "curl -d ''http://192.168.1.33:8060/keypress/Home")
type: script.ScriptAction
Here is a screenshot of the UI:
Are there any known issues with sending commands to command line or am I completely doing this wrong? Thanks, and any help is appreciated.