Hi, Sorry for my English. A have a problem with playSound function in openhab rule. Openhab is installed in raspberry pi 2. I try to play some sound on raspberry (3.5 mini-jack) from Sound folder by using playSound(“name.wav”) in rule file, but it doesnt work. I can show detailed logs only tomorrow, but maybe somebody knows why it doesnt work?
thank
I have the same problem:
playSound("doorbell.wav")
returns 2016-02-19 12:23:42.109 [ERROR] [.o.io.multimedia.actions.Audio] - Cannot play sound 'doorbell.wav': sounds/doorbell.wav (No such file or directory)
and
playSound("/etc/openhab/sounds/doorbell.wav")
returns 2016-02-19 12:23:06.322 [ERROR] [.o.io.multimedia.actions.Audio] - Cannot play sound '/etc/openhab/sounds/doorbell.wav': sounds/etc/openhab/sounds/doorbell.wav (No such file or directory)
Note openhab is trying to open sounds/etc/openhab/sounds/doorbell.wav
(which obviously doesn’t exist as the right absolute path is /etc/openhab/sounds/doorbell.wav
)
Of course, /etc/openhab/sounds/doorbell.wav
does exist. I am running openhab as root, does it change anything?
Nobody on this one?
I solved this problem. I gave root permissions to audio file by chmod) It solved all)
But, I played file by execute comand in comand line. No playSound(). But it works from openhab rules
I am also running openhab as root and root is the owner of the sound file but playSound() doesn’t work. Error is Cannot play sound 'doorbell.wav': sounds/doorbell.wav (No such file or directory)
so it looks more like a path problem than a permission problem.
Of coure executeCommandLine()
with aplay
is an alternative that works but it’s a pity as playSound() is the built-in action in openhab…
Is there anyone here who has successfully used playSound() ??
I use it all the time with mp3s, so I confirm it does work. There was no extra setup or anything I had to do, the apt-get install set all the permissions I needed.
Oh I didn’t know I had to install a specific package! What package is needed?
Sorry, I meant the apt-get install of openHAB, not apt-get install of a specific package/binding. Basically - it worked “out of the box” for me on a pi2.
OK thanks for the precision. Under which user do you run openhab: root or openhab or pi?
openhab, added to the audio group.
Yes, it s necessary to add openhab in etc/group
Thanks Michael. Could you explain how to add the user “openhab” to the audio group?
As @freeholod said, it needs to be added in /etc/group. There will be a long list of groups, one of which is audio. Just add “openhab” to the end of it.