Get Volume using command line?

A simple command will let me lower the volume:

curl 'MY_IP_ADDRESS:3000/api/v1/commands/?cmd=volume&volume=minus'

…but how do I get the volume? I’d like to create a script that tells me what the volume is… and I’d really like to have a simple toggle on/off for mute.

Could you extract it from

volumio.local/api/v1/getstate

e.g.

curl -s 'volumio.local/api/v1/getstate' | sed -r 's/^.*"volume":([[:digit:]]*).*/\1/p'

Get volume using

amixer

mute using

amixer -c X cset 0%

X is device ID, the default is 0

Easier:

volumio volume

will print the current volume

See here:
volumio.github.io/docs/Good_to_ … lient.html

Oh oh OH, that’s it! Rather than extracting the volume, I’ll extract whether or not it is muted (true/false) and create a toggle.

Thanks!