Hi @mike-foundries
Sorry for the delay. It seems that the Alsa outputs are by default muted, as you already noticed.
I did not check this, but I think that the reason why your code doesn’t work for turning off the mute is that you have to unmute the headphone output, and the line variable contains a mixer pointer for the plughw and not the headphone out.
Anyway, you could also try to save the state of the headphone output after disabling the mute with:
$ alsactl store