Bluetooth speaker

  • Platform information:
    • Hardware: CPUArchitecture/RAM/storage
      i3 8 Gbs RAM 1TB spinny H/D
    • OS: what OS is used and which version
      Deb 9
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version: 2.4

I would like to play sounds (doorbell, phone ringing) on my bluetooth speaker from a rule being trigger or whatever. (I don’t need help writing the rule)
so far I found this but it is old and a little complex

is there a way to use the exec binding or something to play a system sound or adjust the system volume from OpenHAB?
the system already uses the bluetooth device as the system sound output

Edits:
here is what I’ve learned so far.

My Debian install came with pulseaudio installed. I installed play so it could play sends from the command line

first install play

sudo apt install sox

And for playing special formats like mp3 you must install its libraries:

sudo apt install libsox-fmt-mp3

And for use it:

play /etc/openhab2/sounds/doorbell.mp3

If you want to use it with full libraries, you must install libsox-fmt-all package:

sudo apt install libsox-fmt-all

gleaned from here

trying to install pulseaudio binding
try to create bridge… errors

02:20:19.744 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'pulseaudio:bridge:db56ea99' changed from UNINITIALIZED to INITIALIZING
02:20:19.746 [ERROR] [.pulseaudio.internal.PulseaudioClient] - Connection refused (Connection refused)
java.net.ConnectException: Connection refused (Connection refused)
	at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:?]
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:?]
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:?]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]
	at java.net.Socket.connect(Socket.java:589) ~[?:?]
	at java.net.Socket.connect(Socket.java:538) ~[?:?]
	at java.net.Socket.<init>(Socket.java:434) ~[?:?]
	at java.net.Socket.<init>(Socket.java:211) ~[?:?]
	at org.openhab.binding.pulseaudio.internal.PulseaudioClient.connect(PulseaudioClient.java:607) ~[?:?]
	at org.openhab.binding.pulseaudio.internal.PulseaudioClient.<init>(PulseaudioClient.java:126) ~[?:?]
	at org.openhab.binding.pulseaudio.internal.handler.PulseaudioBridgeHandler.lambda$1(PulseaudioBridgeHandler.java:131) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]
02:20:19.747 [ERROR] [.pulseaudio.internal.PulseaudioClient] - Connection refused (Connection refused)
java.net.ConnectException: Connection refused (Connection refused)
	at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:?]
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:?]
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:?]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]
	at java.net.Socket.connect(Socket.java:589) ~[?:?]
	at java.net.Socket.connect(Socket.java:538) ~[?:?]
	at java.net.Socket.<init>(Socket.java:434) ~[?:?]
	at java.net.Socket.<init>(Socket.java:211) ~[?:?]
	at org.openhab.binding.pulseaudio.internal.PulseaudioClient.connect(PulseaudioClient.java:607) ~[?:?]
	at org.openhab.binding.pulseaudio.internal.PulseaudioClient.checkConnection(PulseaudioClient.java:595) ~[?:?]
	at org.openhab.binding.pulseaudio.internal.PulseaudioClient.sendRawRequest(PulseaudioClient.java:551) ~[?:?]
	at org.openhab.binding.pulseaudio.internal.PulseaudioClient.listModules(PulseaudioClient.java:162) ~[?:?]
	at org.openhab.binding.pulseaudio.internal.PulseaudioClient.update(PulseaudioClient.java:139) ~[?:?]
	at org.openhab.binding.pulseaudio.internal.PulseaudioClient.<init>(PulseaudioClient.java:127) ~[?:?]
	at org.openhab.binding.pulseaudio.internal.handler.PulseaudioBridgeHandler.lambda$1(PulseaudioBridgeHandler.java:131) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]
02:20:19.749 [WARN ] [ommon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.NullPointerException: null
	at org.openhab.binding.pulseaudio.internal.PulseaudioClient.sendRawRequest(PulseaudioClient.java:554) ~[?:?]
	at org.openhab.binding.pulseaudio.internal.PulseaudioClient.listModules(PulseaudioClient.java:162) ~[?:?]
	at org.openhab.binding.pulseaudio.internal.PulseaudioClient.update(PulseaudioClient.java:139) ~[?:?]
	at org.openhab.binding.pulseaudio.internal.PulseaudioClient.<init>(PulseaudioClient.java:127) ~[?:?]
	at org.openhab.binding.pulseaudio.internal.handler.PulseaudioBridgeHandler.lambda$1(PulseaudioBridgeHandler.java:131) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]

Hi i am using node-red to send exec commands, so i am sure you can do it with OH item also … if you need help i can show you in Node-red, but i am not sure how to do this on OH as standalone item

also i am using windows thanks for the above play guide in Linux … it will help i am sure