TTS (with vlc) on pi not working (even after new install, please help!)

TL;DR: I am actually very close to going clinically insane, can’t get TTS to play on audiojack on my raspberry pi, even after a fresh install on new SD.

I had this issue for a while and couldn’t fix it, so I:

• I bought a brand new SD card
• Installed hassbian img (everything working fine, no errors)
• Installed vlc with sudo apt-get install vlc
• Added this to my configuration.yaml:
media_player:
- platform: vlc
name: s_1
arguments: ‘–alsa-audio-device=hw:1,0’

• set audiojack as default source in raspi-config
• added homeassistant to audiogroup with
sudo usermod -a -G audio homeassistant
• Rebooted
• Stil no bloody sound

The best part: when I playback a test file through the console with vlc whatever.mp3, it works just fine!

here’s my log:

Dec 24 01:45:58 hassbian hass[518]: INFO:homeassistant.core:Bus:Handling <Event call_service[L]: service=google_say, service_call_id=1976191376-14, service_data=message=hallo hallo, entity_id=media_player.s_1, domain=tts>

Dec 24 01:45:58 hassbian hass[518]: INFO:homeassistant.core:Bus:Handling <Event call_service[L]: service=play_media, service_call_id=1976191376-15, service_data=media_content_id=http://192.168.0.12:8123/api/tts_proxy/a110197dbba3b0f14251fb8936f008e147900ca4_en_-_google.mp3, media_content_type=music, entity_id=['media_player.s_1'], domain=media_player>

Dec 24 01:45:58 hassbian hass[518]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state media_player.s_1=idle; media_duration=0.0, media_position_updated_at=2017-12-24T02:40:06.596186+01:00, is_volume_muted=False, friendly_name=s_1, supported_features=16909, media_content_type=music, media_position=0.0, volume_level=1.0 @ 2017-12-24T02:35:48.771128+01:00>, old_state=<state media_player.s_1=idle; media_duration=1.344, media_position_updated_at=2017-12-24T02:40:06.596186+01:00, is_volume_muted=False, friendly_name=s_1, supported_features=16909, media_content_type=music, media_position=0.0, volume_level=1.0 @ 2017-12-24T02:35:48.771128+01:00>, entity_id=media_player.s_1>

Dec 24 01:45:58 hassbian hass[518]: INFO:homeassistant.core:Bus:Handling <Event service_executed[L]: service_call_id=1976191376-15>

Dec 24 01:45:58 hassbian hass[518]: INFO:homeassistant.core:Bus:Handling <Event service_executed[L]: service_call_id=1976191376-14>
Dec 24 01:45:58 hassbian hass[518]: INFO:homeassistant.components.http:Serving /api/tts_proxy/a110197dbba3b0f14251fb8936f008e147900ca4_en_-_google.mp3 to 192.168.0.12 (auth: True)

Dec 24 01:45:59 hassbian hass[518]: ALSA lib pcm_hw.c:1713:(_snd_pcm_hw_open) Invalid value for card
Dec 24 01:45:59 hassbian hass[518]: [00d2d890] alsa audio output error: cannot open ALSA device "hw:1,0": No such file or directory
Dec 24 01:45:59 hassbian hass[518]: [00d2d890] core audio output error: Audio output failed
Dec 24 01:45:59 hassbian hass[518]: [00d2d890] core audio output error: The audio device "hw:1,0" could not be used:
Dec 24 01:45:59 hassbian hass[518]: No such file or directory.
Dec 24 01:45:59 hassbian hass[518]: [00d2d890] core audio output error: module not functional
Dec 24 01:45:59 hassbian hass[518]: [74a036e0] core decoder error: failed to create audio output
Dec 24 01:46:04 hassbian hass[518]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state media_player.s_1=idle; media_duration=1.344, media_position_updated_at=2017-12-24T02:40:06.596186+01:00, is_volume_muted=False, friendly_name=s_1, supported_features=16909, media_content_type=music, media_position=0.0, volume_level=1.0 @ 2017-12-24T02:35:48.771128+01:00>, old_state=<state media_player.s_1=idle; media_duration=0.0, media_position_updated_at=2017-12-24T02:40:06.596186+01:00, is_volume_muted=False, friendly_name=s_1, supported_features=16909, media_content_type=music, media_position=0.0, volume_level=1.0 @ 2017-12-24T02:35:48.771128+01:00>, entity_id=media_player.s_1>

HOLY.SHIT. just figured it out…

The issue was this (its the official recommendation here):

media_player:

  • platform: vlc
    name: speaker_1
    arguments: ‘–alsa-audio-device=hw:1,0’

I changed ‘–alsa-audio-device=hw:1,0’ to ‘–alsa-audio-device=hw:0,0’ (default) and now it works.

hw:1,0 is used to access the first device on the second soundcard/device. Why this is in official HA documentation I don’t know. If that’s by mistake, please change it. Would have saved my A LOT of time.