Smarthome:audio sinks and getting the right output

  • Hardware: RPi(3)
  • OS: OpenHabian
  • Java Runtime Environment: Zulu 8 (32 bit)
  • openHAB version: 2.5.10

Hi folks,

staring to experiment with rules and audio. Finally got my first rule working when I press a button on an ESP. It took me 1 week and the patience of many users on this forum to get it working :slight_smile:

Now I want to start getting the project to fruition. My rule will play a playSound("doorbell.mp3") when I press the button but the sound can only be heard through the HDMI channel, not the audio jack channel of the RPi(3). Any clues as to why? This is what I get when I run in the console:

openhab> smarthome:audio sinks

  • System Speaker (enhancedjavasound)
    Web Audio (webaudio)

If I run aplay -l, both cards are showing:

[20:07:05] openhabian@demeter:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
Subdevices: 4/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 4/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3

Not sure if I have to tell OH2 to use Card1 instead of Card0? PaperUI is only showing System Speaker in Configuration -> System -> Audio. Any thoughts?

You have to choose the audio sink. There are two methods to do this

  1. Choose it via PaperUI. Configuration -> System -> Audio I think
  2. In the rule. Here’s an example
say("Achtung! Es ist draußen um " + DeltaT_String + " Grad wärmer!", "googletts:deDEWavenetE", "chromecast:audio:117d7192836ad331853aa79e96aa2985") //Chromecast Audio

You can find the name of the device in the PaperUI. (See 1)

But I did that and it says “System Speaker” under Audio in PaperUI. I think this is more to do with Rasbian (see here). I could force Jack output is only i could run sudo raspi-config. In fact, this is the output:

raspi-config is not part of openHABian, please use openhabian-config instead.

But I couldn’t find anything to configure under openhabian-config.

Did you google on how to force output though 3.5mm? The raspi-config is only able to change config files.

Tried, sudo apt install raspi-config. Then launched the app, selected the jack output and it simply gets ignored. In the end, the only working option is to unplug HDMI and reboot RPi(3).

Try this amixer cset numid=3 1