Hi,
ich möchte gern über executeCommand in einer Rule ein Script ausführen.
Das Script für leiser macht folgendes (funktioniert bei direktem Ausführen auch):
Im Log bekomme ich jedoch einen Fehler des amixers:
Habt ihr eine Idee warum die Parameter nicht korrekt übergeben werden?
ich möchte gern über executeCommand in einer Rule ein Script ausführen.
Code:
rule "Lautstärke WC" when Item Volume_EG_Bad received update then logInfo("Lautsprecher.rule", "Volume_EG_Bad:" + Volume_EG_Bad.state) if (Volume_EG_Bad.state == 1) { var String results = executeCommandLine("/etc/openhab2/scripts/increaseVolumeEGBad.sh", 5000) logInfo("exec1", results) } if (Volume_EG_Bad.state == 2) { var String results = executeCommandLine("/etc/openhab2/scripts/decreaseVolumeEGBad.sh", 5000) logInfo("exec2", results) } end
Code:
#!/bin/bash amixer -c1 set Speaker -d Front 2dB-
Code:
2017-01-06 20:37:47.697 [INFO ] [thome.model.script.Lautsprecher.rule] - Volume_EG_Bad:2 2017-01-06 20:37:47.765 [INFO ] [eclipse.smarthome.model.script.exec2] - Invalid card number. Usage: amixer <options> [command] Available options: -h,--help this help -c,--card N select the card -D,--device N select the device, default 'default' -d,--debug debug mode -n,--nocheck do not perform range checking -v,--version print version of this program -q,--quiet be quiet -i,--inactive show also inactive controls -a,--abstract L select abstraction level (none or basic) -s,--stdin Read and execute commands from stdin sequentially -R,--raw-volume Use the raw value (default) -M,--mapped-volume Use the mapped volume Available commands: scontrols show all mixer simple controls scontents show contents of all mixer simple controls (default command) sset sID P set contents for one mixer simple control sget sID get contents for one mixer simple control controls show all controls for given card contents show contents of all controls for given card cset cID P set control contents for one control cget cID get control contents for one control
Kommentar