I’m testing pulseaudio binding with openHAB 3.2.0.M1.
For me, almost everything works properly.
openHAB is running on a Ubuntu 20.04 VM with pulseaudio 13.99.1 running in system mode.
I paired a bluetooth speaker and I register the sink in openHAB and I’m able to play sound through it in console or in rules.
However, I found a little quirk…
Using a playSound
action in a DSL rule with volume, doesn’t work as it should. Either the sink changes volume for ~ 1 sec. and reverts or it doesn’t change at all.
Example action:
playSound("pulseaudio:sink:951732ff44:bluez_sink_88_C6_26_28_A4_B0_a2dp_sink", "dingdong.mp3", new PercentType(50))
Looks like a problem with pulseaudio rather then openHAB and/or the binding itself.
pulseaudio log shows that the change volume command is received:
Aug 10 10:47:17 openhab pulseaudio[66478]: Created 28 "TCP/IP client from 127.0.0.1:40314"
Aug 10 10:47:17 openhab pulseaudio[66478]: The reference volume of sink bluez_sink.88_C6_26_28_A4_B0.a2dp_sink changed from front-left: 13107 / 20% / -41.94 dB, front-right: 13107 / 20% / -41.94 dB to front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB.
Aug 10 10:47:17 openhab pulseaudio[66478]: Storing volume/mute for device+port sink:bluez_sink.88_C6_26_28_A4_B0.a2dp_sink:headset-output.
Aug 10 10:47:17 openhab pulseaudio[66478]: CLI got EOF from user.
Aug 10 10:47:17 openhab pulseaudio[66478]: Freed 28 "TCP/IP client from 127.0.0.1:40314"
Aug 10 10:47:17 openhab pulseaudio[66478]: TCP connection accepted by tcpwrap.
Aug 10 10:47:17 openhab pulseaudio[66478]: Created 29 "TCP/IP client from 127.0.0.1:40316"
Aug 10 10:47:17 openhab pulseaudio[66478]: CLI got EOF from user.
Aug 10 10:47:17 openhab pulseaudio[66478]: Freed 29 "TCP/IP client from 127.0.0.1:40316"
Aug 10 10:47:17 openhab pulseaudio[66478]: TCP connection accepted by tcpwrap.
Aug 10 10:47:17 openhab pulseaudio[66478]: Created 30 "TCP/IP client from 127.0.0.1:40320"
Aug 10 10:47:18 openhab pulseaudio[66478]: CLI got EOF from user.
Aug 10 10:47:18 openhab pulseaudio[66478]: Freed 30 "TCP/IP client from 127.0.0.1:40320"
Aug 10 10:47:18 openhab pulseaudio[66478]: TCP connection accepted by tcpwrap.
Aug 10 10:47:18 openhab pulseaudio[66478]: Created 31 "Simple client (TCP/IP client from 127.0.0.1:49062)"
Aug 10 10:47:18 openhab pulseaudio[66478]: Not restoring device for stream sink-input-by-application-name:Simple client (TCP/IP client from 127.0.0.1:49062), because already set to 'bluez_sink.88_C6_26_28_A4_B0.a2dp_sink'.
Aug 10 10:47:18 openhab pulseaudio[66478]: Negotiated format: pcm, format.sample_format = "\"s16le\"" format.rate = "44100" format.channels = "2"
Aug 10 10:47:18 openhab pulseaudio[66478]: Sink bluez_sink.88_C6_26_28_A4_B0.a2dp_sink becomes busy, resuming.
Aug 10 10:47:18 openhab pulseaudio[66478]: Acquiring transport /org/bluez/hci0/dev_88_C6_26_28_A4_B0/sep1/fd1
Aug 10 10:47:18 openhab pulseaudio[66478]: Transport /org/bluez/hci0/dev_88_C6_26_28_A4_B0/sep1/fd1 acquired: fd 42
Aug 10 10:47:18 openhab pulseaudio[66478]: Transport /org/bluez/hci0/dev_88_C6_26_28_A4_B0/sep1/fd1 resuming
Aug 10 10:47:18 openhab pulseaudio[66478]: Stream properly set up, we're ready to roll!
Aug 10 10:47:18 openhab pulseaudio[66478]: bluez_sink.88_C6_26_28_A4_B0.a2dp_sink: suspend_cause: IDLE -> (none)
Aug 10 10:47:18 openhab pulseaudio[66478]: bluez_sink.88_C6_26_28_A4_B0.a2dp_sink: state: SUSPENDED -> IDLE
Aug 10 10:47:18 openhab pulseaudio[66478]: Sink bluez_sink.88_C6_26_28_A4_B0.a2dp_sink becomes idle, timeout in 5 seconds.
Aug 10 10:47:18 openhab pulseaudio[66478]: bluez_sink.88_C6_26_28_A4_B0.a2dp_sink.monitor: suspend_cause: IDLE -> (none)
Aug 10 10:47:18 openhab pulseaudio[66478]: bluez_sink.88_C6_26_28_A4_B0.a2dp_sink.monitor: state: SUSPENDED -> IDLE
Aug 10 10:47:18 openhab pulseaudio[66478]: Sink bluez_sink.88_C6_26_28_A4_B0.a2dp_sink becomes idle, timeout in 5 seconds.
Aug 10 10:47:18 openhab pulseaudio[66478]: memblockq requested: maxlength=33554432, tlength=0, base=4, prebuf=0, minreq=1 maxrewind=0
Aug 10 10:47:18 openhab pulseaudio[66478]: memblockq sanitized: maxlength=33554432, tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
Aug 10 10:47:18 openhab pulseaudio[66478]: Created input 1 "(null)" on bluez_sink.88_C6_26_28_A4_B0.a2dp_sink with sample spec s16le 2ch 44100Hz and channel map front-left,front-right
Aug 10 10:47:18 openhab pulseaudio[66478]: application.name = "Simple client (TCP/IP client from 127.0.0.1:49062)"
Aug 10 10:47:18 openhab pulseaudio[66478]: simple-protocol.peer = "TCP/IP client from 127.0.0.1:49062"
Aug 10 10:47:18 openhab pulseaudio[66478]: module-stream-restore.id = "sink-input-by-application-name:Simple client (TCP/IP client from 127.0.0.1:49062)"
Aug 10 10:47:18 openhab pulseaudio[66478]: memblockq requested: maxlength=88200, tlength=88200, base=4, prebuf=18446744073709551615, minreq=8820 maxrewind=0
Aug 10 10:47:18 openhab pulseaudio[66478]: memblockq sanitized: maxlength=88200, tlength=88200, base=4, prebuf=79384, minreq=8820 maxrewind=0
Aug 10 10:47:18 openhab pulseaudio[66478]: bluez_sink.88_C6_26_28_A4_B0.a2dp_sink: state: IDLE -> RUNNING
Aug 10 10:47:18 openhab pulseaudio[66478]: Dropped redundant event due to change event.
Aug 10 10:47:18 openhab pulseaudio[66478]: Storing volume/mute/device for stream sink-input-by-application-name:Simple client (TCP/IP client from 127.0.0.1:49062).
Aug 10 10:47:18 openhab pulseaudio[66478]: Interface org.PulseAudio.Ext.StreamRestore1.RestoreEntry added for object /org/pulseaudio/stream_restore1/entry68
Aug 10 10:47:18 openhab pulseaudio[66478]: Transport /org/bluez/hci0/dev_88_C6_26_28_A4_B0/sep1/fd1 state: idle -> playing
Aug 10 10:47:18 openhab pulseaudio[66478]: Setting card bluez_card.88_C6_26_28_A4_B0 profile a2dp_sink to availability status yes
Aug 10 10:47:18 openhab pulseaudio[66478]: Setting port headset-output to status yes
Aug 10 10:47:18 openhab pulseaudio[66478]: Dropped redundant event due to change event.
Aug 10 10:47:18 openhab pulseaudio[66478]: Resuming sink bluez_sink.88_C6_26_28_A4_B0.a2dp_sink because its transport state changed to playing
Aug 10 10:47:18 openhab pulseaudio[66478]: Properties changed in transport /org/bluez/hci0/dev_88_C6_26_28_A4_B0/sep1/fd1
Aug 10 10:47:18 openhab pulseaudio[66478]: Requesting rewind due to end of underrun.
Aug 10 10:47:18 openhab pulseaudio[66478]: TCP connection accepted by tcpwrap.
Aug 10 10:47:18 openhab pulseaudio[66478]: Created 32 "TCP/IP client from 127.0.0.1:40328"
Aug 10 10:47:18 openhab pulseaudio[66478]: The reference volume of sink bluez_sink.88_C6_26_28_A4_B0.a2dp_sink changed from front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB to front-left: 13107 / 20% / -41.94 dB, front-right: 13107 / 20% / -41.94 dB.
Aug 10 10:47:18 openhab pulseaudio[66478]: Storing volume/mute for device+port sink:bluez_sink.88_C6_26_28_A4_B0.a2dp_sink:headset-output.
Aug 10 10:47:18 openhab pulseaudio[66478]: CLI got EOF from user.
Aug 10 10:47:18 openhab pulseaudio[66478]: Freed 32 "TCP/IP client from 127.0.0.1:40328"
So, happy to report that I’m happy to the way it works!
After all, I’m the one who asked some 4 years ago to implement the sinks for pulseaudio