Change raspberry volume

Hi,

I would like to know if there is an universal way to change the volume of the output on the raspberry.

Actually with snips or rhasspy, I have a script in Jeedom that start an SSH command on the pi with this:

amixer -c 0 set Playback xx%

I would like to provide such command for rhasspy devices in Jeedom plugin, but for this I have to know the pi login and password per device, and:

  • Does amixer always work whatever asound conf is ?
  • For all my pi, I disable the onboard sound card, so all my pi have the respeacker as card id 0. But how can we know the right card id ?

Would there be a way to do it with rhasspy, as rhasspy actually does know our output device ?

As for every rhasspy device in the plugin, I get the profile (/api/profile) I could get the sounds.aplay
ex:

"sounds": {
        "aplay": {
            "device": "default:CARD=seeed2micvoicec"
        }
    },

So, could I use this to start command like this ?

amixer -D default set Playback xx%

But does amixer set Playback always works ?
Sorry, not familiar with linux :wink:

And is there a way to start such command without knowing pi login/password ?
Sending such command to rhasspy over http api or mqtt topic and it would run the sent command with subprocess.call(cmd) on right siteId ?

Setting volume between day and evening is important for me and a lot of users (not having rhasspy talking too loud at evening when sons are in bed for example). So maybe Rhasspy could provide mqtt topic or such way to do it ?

Thks