Rule to change volume

OH 3rpi 3b

hi i have a rule from this forum :
rule “volume”
Item Volume changed
executeCommandLine("amixer sset Headphone " + Volume.state.toString() + “%”)

when i upgraded to OH3 i cant use it enymore
from log :
2021-04-12 12:21:42.035 [WARN ] [] - Error occurred when executing commandLine ‘[amixer sset Headphone 98.0%]’ Cannot run program “amixer sset Headphone 98.0%”: error=2, No such file or directory
at java.lang.ProcessBuilder.start( ~[?:?]
at java.lang.ProcessBuilder.start( ~[?:?]
at [bundleFile:?]
at org.openhab.core.model.script.actions.Exec.executeCommandLine( [bundleFile:?]

someone know what to do to fix it ?

executeCommandLine syntax has changed for OH3,it was advised in the release notes.
There are dozens of posts here about practical examples, most importantly you should use multiple parameters instead of spaces.

1 Like

thx, and sorry for another topic :wink:

Let us know if you try and fail. It’s not a particularly easy command to sort out.

i try and now it works
executeCommandLine(“amixer”, “set” , “Headphone”, Volume.state.toString +"%")

1 Like