rule "Set Volume to 80 at 8 am"
when
Time cron "0 0 8 ? * * *"
then
executeCommandLine("amixer set PCM -- 80%")
end
rule "Set Volume to 20 at 8:30 pm"
when
Time cron "0 30 20 ? * * *"
then
executeCommandLine("amixer set PCM -- 20%")
end
logInfo ("test-rule", "Master volume is " + getMasterVolume())
setMasterVolume(new PercentType(10))
logInfo ("test-rule, "New master volume is " + getMasterVolume())
Which will produce something like
2018-01-27 12:00:03.022 [INFO ] [se.smarthome.model.script.test.rules] - Master volume is 0.2
2018-01-27 12:00:03.022 [INFO ] [se.smarthome.model.script.test.rules] - New master volume is 0.1
This seems to apply the volume to the default audio sink defined in Paper UI. I think this will work for notifications played through Sonos and Squeezebox. I’m not sure about other bindings that support audio sink, or System Speaker.