Hi.
I have Raspberry Pi 3 and Samsung Soundbar HW-H550 which supports BT and can even be turned on by BT. So I thought that it would be cool if my hass could turn it on as soon as I get home and play my favorite radio station.
I managed to connect my raspberry Pi 3 to soundbar via BT - I needed to install pulseaudio and pulseaudio-module-bluetooth. After doing it right clicking the speaker icon caused to show up dialog with 3 items “Analog”, “HDMI” and “[Samsung] Soundbar” (via BT).
Awesome. I tried to call aplay /usr/shared/sound/alsa/Front_Center.wav (as user pi) to check if everything works and it did work - I could hear the text via Soundbar.
Now I’ve installed vlc sudo apt-get install vlc and opened it to check if it can play radio stream via Soundbar. It can, everything seems to work.
I configured hass to use platform vlc as a media_player. Restarted the hass and opened hass web interface. I opened Development->Services and tried to call service media_player.play_media with data:
{“media_content_id”: “http://streaming.streamonomy.com/harddrivin”,
“media_content_type”:“music”}
No effect. Music isn’t playing. I took a look at the hass logs, but nothing from vlc was there. So I opened terminal on Raspberry Pi and changed user to homeassistant. I tried to execute aplay /usr/shared/sound/alsa/Front_Center.wav again and the output was:
homeassistant@raspberrypi:/home/pi $ aplay /usr/share/sounds/alsa/Front_Center.wav
No protocol specified
xcb_connection_has_error() returned true
No protocol specified
No protocol specified
xcb_connection_has_error() returned true
Playing WAVE ‘/usr/share/sounds/alsa/Front_Center.wav’ : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
and no sound at all. I guess that has something in common with pulse, so I’ve added user homeassistant to groups ‘audio’, ‘pulse’ and ‘pulse-access’. Effect is still the same - I cannot play the sound via Soundbar as homeassistant user. Anyone could help me with that?
I’m running Raspbian upgraded to the newest distribution.
EDIT:
After switching audio output to HDMI and connecting TV I also get the xcb_connection_has_error() returned true error as homeassistant user, but sound is heard via TV…
EDIT2:
I’ve also realised that if I have the BT turned on during reboot of Raspberry Pi (and soundbar is set as trusted) then I can listen to the music via Soundbar. However If I turn off the BT before reboot and enable it after rebooting, I cannot choose Soundbar as an output - it is visible after right clicking on speaker icon in the tray, however nothing happens. Initially there’s a green tick next to the HDMI output in that case. After trying to connect to Soundbar, the tick disapears at all - like no output was selected.Playing a wave now results in complete silence - both on TV and soundbar. Anyone has any idea what can be wrong?