playSound stops working

Odd problem with playSound sometimes not working. System is configured to use system default sound. playSound works for days and then occasionally just quits working. I’ll notice it isn’t working and go into Paper UI --> configure —> system —> audio and switch from system default to web audio and it immediately work (if a web browser is open) Then I’ll go back and switch it back from web audio to system default and as soon I click the save button to confirm the change, all the sounds that were supposed to have played all play at once! It is as if something was blocking them or one gets stuck and blocks the rest and switching to web audio and back clears it out

When it is not working smarthome:audio play some.mp3 from the command line also does not work. I wrote a test rule with log statements before and after command playSound and logs statements appear in the log as expected (but no sound)

Nothing appears in the log when the sound is supposed to play and doesn’t. When the switch from web audio to system default and back happens and all the sounds play at once, normal log statements for each sound are immediately seen in the log

Sound in OpenHAB seems considered trivial but the system dingng, ringing and making other sounds to indicate things is super important and useful to me and I just can’t seem to get it to consistently work

PC with I3 8 gbs ram 1 tb h/d with Mint Linux

1 Like

The next time it fails, see if you can play something using pulsaudio from the Linux command prompt using aplay or some other audio player. The problem may or may not be inside openHAB.

OK, thanks for clue Rich

OK, I just had time to test this. Sound in OpenHAB has stopped working again. Using mpg123 from the command line, the same mg3 files play. To be clear, playing sounds from the command line works, playSound in OpenHAB is not working.

Switching from system default to web audio and back in OpenHAB config will fix it I’m sure but I want to try to run down the problem while it is in it’s ‘broken’ state.

enable verbosity of your pulseaudio daemon ( -vvv ) and then take a look at the results when the error happens again.

note that openhab uses alsa to output sound and pulseaudio grabs that stream and plays it

here is another clue
when I typed:
pulseaudio --kill
all the built up sounds all played at once!
after restarting pulseaudio --start playSound on OpenHAB command line still does NOT work

smarthome:audio play text.mp3 

does nothing… no error in the log…

Edit to add:
a restart (required for other reasons) has restored playSound to functioning. That gives me no confidence of it stopping working again. I’m convinced this might be an OpenHAB issue because the system audio works normally.

Does anyone have a clue as to where to file an issue with the playSound command?
Is it part of the core?

I’m pretty sure audio is part of core.

1 Like

same happened with me but i don’t know the reason but i switched from ubuntu to arch i thought my sounds are not working so i checked with mpv but sound is working playysound just got stuck no error too.

wow… old thread
I got it working at one point awhile back, that was on OH2. If I set the system to web audio and had either paperUI or habpanel open, it worked

currently

audio play doorbell.mp3

does nothing
now I am on 3.2.0.M5 and it says in the docs

The browser needs to be opened and have a compatible UI running. Currently this feature is only supported by HABPanel.

Thanks i haven’t tried it as now i have switched to pydub module.