setMasterVolume in OH2 / rpi3

Im using a RPI3 with OH2 and would like to control the volume of the 3.5 mm audio output.
Sound is working since playSound(“doorbell.mp3”) works as expected, only thing is that I would like to control the volume.
Can someone give me the right syntax (or example) for setMasterVolume( x ) ?

Tnx in advance,


x is of type percentType or float (I think 0…1) so

val float myVol = 0.5

should work within rules. As I’m not using sound within openHAB, this is theory … :wink:

Hi Udo,

Thanks but it doesn’t work for me, also tried

setMasterVolume(new PercentType(50))

Looks setMasterVolume doesn’t work at all in openHAB2.


PS Error message = Cannot resolve proxy: java:/Objects/org.openhab.core.library.types.PercentType#org.openhab.core.library.types.PercentType

have you try this ? perhaps this works :wink:

executeCommandLine("amixer set PCM -- 100%")