VLC with Google TTS on Raspberry Pi

I am trying to get VLC working with Google TTS.
VLC is installed, wav files are playing well through 3.5 mm analog output of the RPi3 outside HA. I added TTS Google to my configuration.yaml.

I can’t get TTS to play either from the HA service page of the web interface, or through a notification service.
The VLC media player is listed in the components page as media_player.unnamed_device. When I activate the service, no errors are thrown to the interface or to HA log, but no sound.

What am I missing here? Do I need to name the media player (although naming in configuration.yaml gives an error, because naming is not supported for the vlc platform), or bind it to HA in some way?

Ruud

This solved my problem (adding homeassistant user to audio group):
sudo usermod -a -G audio homeassistant

1 Like

Yes! That did it. Thank you.

Should I keep referring to the vlc media player as media_player.unnamed_device or is there a way to give it a more legible name?

You can specify a name if you want: https://home-assistant.io/components/media_player.vlc/#full-configuration

It would be great if one of you can add that tips to the documentation.
In the upper right corner of any documentation page, you will find “Edit this page on GitHub”.
Follow the link and submit your suggested change.
Demonstrated here: https://youtu.be/dRfk9JAlPJk?t=1h16m17s

Thanks, Daniel, that worked. I am still learning yaml and linux the hard way… I think I made a mistake by inserting a "- " before the name statement.

1 Like

is this to be done only one time, or each reboot?

Claudio, only once.

i have the same problem that you. Can you share please your configurarion files?

edit: i add this line sudo usermod -a -G audio homeassistant and after that i do a reboot and now works.

I am running homeassistant via the pi user:

I’ve run
sudo usermod -a -G audio pi

This the automation I am trying (the file is located under www folder)

- id: 'test go go'
  alias: 'lets test'
  hide_entity: false
  trigger:
  - platform: event
    event_type: click
    event_data:
      entity_id: binary_sensor.switch_158xxxxxxxxxxx
      click_type: double
  action:
    service: media_player.play_media
    data:
      entity_id: media_player.homesound
      media_content_id: '/local/test.mp3'
      media_content_type: 'music'

I’ve also tried
media_content_type: 'audio/mp3'
with no luck.

this is my configuration file:

media_player:
  - platform: vlc
    name: homesound
    arguments: '--alsa-audio-device=hw:1,0'

I am running on rasp pi 2. The file correctly plays through ssh via vlc test.mp3.

Thank you

arguments: '--alsa-audio-device=hw:0,0'
fixed it.

I used ls -l /proc/asound/card* to find devices of rasp pi 2.

Then used cat /proc/asound/card0/pcm0p/info to identify the card. It was what I needed.

cat /proc/asound/card0/pcm1p/info gave hdmi.

1 Like

I solved my problem, here: Help me with rp3 and mediaplayer

Please help.

VLC player has problem with TTS Google if the “message” input more than 4 words OR play a audio file/url (.mp3) with duration more than 2 seconds.

I tried to edit vlc.py in “…/site-packages/homeassistant/components/media_player”:

""" line 147 and 163 """
global audio_playing
audio_playing = True
self._vlc.play()
while audio_playing:
continue

but can’t fix it.

who can help me…

Hi, you cannot run sudo usermod -a -G audio homeassistant on Home Assistant OS, even in internal terminal. How to add user there?