OH3: Volume control „Master“ is missing

In OH3 there is only „Headphones“ available as Volume Control. There is no Master.
amixer scontrols:
Simple mixer control 'Headphone',0

When I run this command in .rules

playSound("enhancedjavasound", "doorbell.mp3", new PercentType(100))

I get the following error message

Cannot determine master volume level - assuming 100%

Anybody knows what needs to be done?

I am struggling with the same problem. I’m running an Raspberry Pi4b. Hope someone knows an awnser. I already searched for more dan 2 hours and tried serveral things:

amixer -c 0 cset numid=3 1
amixer: Cannot find the given element from control hw:0

sudo systemctl start pulseaudio.service
Failed to start pulseaudio.service: Unit pulseaudio.service not found.

amixer
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 1 [0%] [on]
  Front Right: Playback 1 [0%] [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 65536
  Front Left: Capture 65536 [100%] [on]
  Front Right: Capture 65536 [100%] [on]

SpeakerTest also doesn’t sound anything. I changed from a raspberry pi3b - openhab2.5 > to RPi 4b with openhab 3.0.

try

amixer -c 0 cset numid=3 100%

You can find the right given element (numid) with this command:

amixer controls

or try

amixer sset Master 100%
1 Like

Thanks! this worked. Not sure what did the trick (i also powered the pi down this night). but when i woke up, i executed:

amixer controls > numid was 3
amixer -c 0 cset numid=3 100%

got this error:

[09:36:54] openhabian@openHABianDevice:~$ amixer -c 0 cset numid=3 100%
amixer: Cannot find the given element from control hw:0

after that i tried:
amixer sset Master 100%

and it works! tested it via karaf say command and the pi is alive! It speaks! :wink:

Thanks!

Well the sound works, but it still have the problem with:

Cannot determine master volume level - assuming 100%

On the command line i’m able to change it; amixer sset ‘Master’ 80% works, speakertest is clearly lower.

But I can’t use it in rules because Openhab cannot determine master volume level and set’s it back to 100%.

If I want to executecommanline in rules, it also doens’t work:

executeCommandLine("amixer sset Master 80%") > Cannot run program "amixer sset Master 60%": error=2, File or directory doesn't exist

oh3

executeCommandLine(Duration.ofSeconds(1),"amixer", "set" , "Master", "80%")

Hmm tried that, didn’t have an error anymore. But also doens’t do anything strange enough. It looks like it executed without logging anything, and the volume didn’t change:

executeCommandLine(Duration.ofSeconds(1),"amixer", "sset" , "Master", "79%")
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 52429 [80%] [on]
  Front Right: Playback 52429 [80%] [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 65536
  Front Left: Capture 65536 [100%] [on]
  Front Right: Capture 65536 [100%] [on]

It stays at 100%, when playing an mp3 via playsound or say action. Including the error:

Cannot determine master volume level - assuming 100%

That’s even more interesting that you still have this error message because you already have a master volume control.
I did a fresh install of openHABian and “Master” is missing.
Seems that something is wrong with openHABian’s sound configuration

Could you please post the content of this file?

/var/lib/alsa/asound.state

I want to update my file with your settings

Yes, this is the file:

state.Headphones {
        control.1 {
                iface MIXER
                name 'Headphone Playback Volume'
                value 400
                comment {
                        access 'read write'
                        type INTEGER
                        count 1
                        range '-10239 - 400'
                        dbmin -9999999
                        dbmax 400
                        dbvalue.0 400
                }
        }
        control.2 {
                iface MIXER
                name 'Headphone Playback Switch'
                value true
                comment {
                        access 'read write'
                        type BOOLEAN
                        count 1
                }
        }
}

did you try? Headphone

executeCommandLine("amixer", "set" , "Headphone", "50%")

worked on me rpi3 b oh3

executeCommandLine("amixer", "set" , "Headphone", Volume.state.toString +"%")

Yeah, i did try it already but to be sure tested it again as this:

executeCommandLine(Duration.ofSeconds(1),"amixer", "sset" , "Headphones", "30%")
executeCommandLine(Duration.ofSeconds(1),"amixer", "set" , "Headphones", "30%")
executeCommandLine(Duration.ofSeconds(1),"amixer", "set" , "Headphone", "30%")

but the log doesn’t show anything and the volume doesnt change:

[14:16:24] openhabian@openHABianDevice:~$ amixer
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 52429 [80%] [on]
  Front Right: Playback 52429 [80%] [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 65536
  Front Left: Capture 65536 [100%] [on]
  Front Right: Capture 65536 [100%] [on]

that works but the problem remains that it does not work with this command:

playSound("enhancedjavasound", "doorbell.mp3", new PercentType(100))

as playSound seems to address “Master” volume control only.
that problem is a known problem which has already been fixed
https://community.openhab.org/t/warning-audio-sink-warning-master-volume-level/44789/5
for any reason it reapeared in openhabian

Not sure why, but i don’t hear anything now. I rebooted a couple of times. Lots of troubles in my rules in upgrading from OH2.5 to OH3. I use a lot of datetime items and there has been a lot of changes… In the meanwhile trying to get openhab to speak/make sound.

[15:11:46] openhabian@openHABianDevice:~$ amixer -c 0 cset numid=3 100%
amixer: Cannot find the given element from control hw:0

[15:12:18] openhabian@openHABianDevice:~$ amixer sset Master 100%
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 65536 [100%] [on]
  Front Right: Playback 65536 [100%] [on]

Seems like it’s getting worse for some reasons.

probably the ID is wrong. You can get it by amixer controls. please post the results.
Anyway, you do’t need that command as amixer sset Master 100% works for you

That’s the strange part, if I execute amixer controls, i get:

numid=4,iface=MIXER,name='Master Playback Switch'
numid=3,iface=MIXER,name='Master Playback Volume'
numid=2,iface=MIXER,name='Capture Switch'
numid=1,iface=MIXER,name='Capture Volume'

amixer sset Master 100% works indeed, but i don’t hear anything when i test it with: speaker-test

Something went wrong but can’t think of anything that has been changed in the meanwhile…

did you do an update or a clean install?
Before fresh install, everything was working fine.

I did a clean install. On a new raspberry pi4b. I’m not sure if I did a restore or not. Having a lot of problems upgrading. But I think the last (this) time i did complete clean install because of some problems with reverse proxy and sitemaps which were unreachable.

Everything is/was working without any problem on my pi3b with openhab 2.5.10 (it’s still my main openhab server, but i shut it down to migrate the new pi4 to openhab 3.0)

I just did a clean install and it just won’t work. The last time i tried a couple of things but the situation is now complete clean install and for some reason the 3.5mm device isn’t recognised on the Rpi4b.

I tried a couple of things:

[10:30:15] openhabian@openHABianDevice:~$ amixer controls
numid=2,iface=MIXER,name='Headphone Playback Switch'
numid=1,iface=MIXER,name='Headphone Playback Volume'
[10:30:39] openhabian@openHABianDevice:~$ amixer sset Master 100%
amixer: Unable to find simple control 'Master',0

[10:30:41] openhabian@openHABianDevice:~$ amixer sset Headphone 100%
Simple mixer control 'Headphone',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback -10239 - 400
  Mono: Playback 400 [100%] [4.00dB] [on]

And it says that the device is mono, and that’s not correct. it’s a stereo output. I connected a stereo speaker but i got no sound. Anyone has an idea what to do?

(I just saw i used the image: openhabian-pi-raspios32-v1.6.2.img.xz in stead of openhabian-pi-raspios32-v1.6.2b.img.xz, does that matter?)

Ok, really strange. Due to some problems with Telegram binding (My old 2.5 is still running and Telegram conflicts when you connect more then one instance to a botToken) A bug in the binding kept spitting errors in the log, know issue, and i had to stop openhab and clean cache.

Just out of curiosity I checked again if i had sound, and i got speech working. I can change volume with amixer sset Headphone 100%. I’m testing it via karaf at the moment, because of the migration. The log keeps getting this error:

Cannot determine master volume level - assuming 100%

Now you are exactly at the same point where I am :slight_smile:
At least this behaviour is reproducable.