Java Runtime Environment: openjdk 1.8.0_222 is installed in the openhab docker image
openHAB version: openhab:milestone docker image
Issue of the topic:
I have created a rule to play a sound when my contact sensor changes:
rule "rule test"
when
Item AqaraContact changed
then
logDebug("test", "blah test")
playSound("glados.wav")
end
Whenever the rule is executed, I see this error in my logs:
2019-08-17 22:16:54.768 [WARN ] [ab.io.javasound.internal.AudioPlayer] - No line found: No line matching interface SourceDataLine supporting format PCM_SIGNED 44100.0 Hz, 16 bit, mono, 2 bytes/frame, 22050.0 frames/second, little-endian is supported.
2019-08-17 22:16:54.770 [INFO ] [ab.io.javasound.internal.AudioPlayer] - Available lines are:
I am able to play the same sound file from the command line on the pi and from the command line if I go into the docker container itself (using docker exec -it container_id /bin/bash).
Openhab runs under root in my docker container. I couldnāt get the docker container to run as openhab with the openhab group for some reason, so I found an option to run as root in the documentation for the openhab docker image.
Iām leaving the question here in case it is useful to anyone else. I resolved it immediately after posting, even though Iāve been fighting with this for hours (typical).
I did use the official openhab documentation. It includes a link and recommendation to refer to the documentation on docker hub as well.
I experienced two problems when using only the documentation at openhab.org (before I tried the compose config example on docker hub).
Systemd was giving me trouble. I never figured out why, and it didnāt seem important enough at the time. I still had the option of starting the container manually, or using compose. I ran it manually for a while and then switched to compose.
Audio playback through the rule didnāt work. I did stumble across errors different from what I posted, which led me to posts in this community about permissions errors. All of the posts I found were not working with docker, but I still tried treating this as a permissions problem. I re-did the user/group parameters in the docker run command (should be equivalent to my compose file) and host config multiple times, thinking I must have missed a step. I was unable to get audio working until I found the blurb about running as root in the docker hub documentation.
Do you have a step in mind that I might have missed in the documentation? I would like to have my setup as close as possible to the standard recommendation, without the container using root by default.
Since Iām using docker, itās very easy for me to retry this process. Iām happy to walk through things with people here for my own benefit and for the sake of anyone else that experiences the same problem.
Hi I have exaxtcly the same problemā¦I get the following logs:
2021-03-02 13:38:40.726 [WARN ] [nternal.javasound.JavaSoundAudioSink] - Cannot determine master volume level - assuming 100%
2021-03-02 13:38:40.807 [ERROR] [nternal.javasound.JavaSoundAudioSink] - An exception occurred while playing audio : 'Cannot create AudioDevice'
Iāve tried every community-solution provided, but cannot run sound through the haedphonejack of the piā¦Iām running on 3.0.1 with composeā¦can you show me how you got it to work? I use hypriot-os so maybe I have to load some modulesā¦can you point me which?
Having exactly the same issue, unable to play any sound, Iām now looking at setting up a pulse audio server on the host and pass that stream over the āvirtualā network, but well, I donāt know if itās the right way to go⦠More stable for the next releases I guessā¦
Hello, I have the same problem, Iām using OH 3.2.0 with docker (as user āopenhabā, not root) running from command line, I also added āādevice=/dev/snd:/dev/sndā to docker run command, and I also added āopnehabā user to audio group with āsudo adduser openhab audioā. Iām still not able to play sound, the error is: " An exception occurred while playing audio : āCannot create AudioDeviceā. Any help will be very appreciated. Thanks.