No audio tts.google_say but VLC audio is ok

TTS service has stopped working and I don’t know why… before today all was worked fine with audio.
This is my config …

http:
  api_password: ***********
  base_url: https://www.******.online:8123
  ssl_certificate: /home/****/.homeassistant/fullchain.pem
  ssl_key: /home/****/.homeassistant/privkey.pem  
media_player:
 - platform: vlc
    name: speaker_1
    arguments: '--alsa-audio-device=hw:0,0'   
tts:
  - platform: google
    language: 'it'

Tested audio output with …
cvlc --vout none LRMonoPhase4.wav
… all works good!

Tried to call tts.google_say in my config and even in the dev tools but I’ve no audio!
In the dev tools I called…
service: tts.google_say
entity: media_player.speaker_1
data: {"entity_id": "media_player.speaker_1", "message": "Hello"}
Why I’ve no audio?

I see the space for name: speaker_1 and arguments: ‘–alsa-audio-device=hw:0,0’

  - platform: vlc
    name: HA Speaker
    arguments: '--alsa-audio-device=hw:0,0'

The spaces is a misformatting in the post (sorry about that) in my config the indentations it’s ok.
So… my config seems to be identical to your.

Did you try from ssh.
sudo usermod -a -G audio homeassistant <== this to allow homeassistant user to use pi audio. From your test in ssh console you test from pi user not from homeassistant user.

also the (ha ip) base_url: ip_address:8123 <== this has to be the ip address not localhost or 127.0.0.1

I found that some people setting are different depending on hardware they use.
arguments: ‘–alsa-audio-device=hw:0,0’
some use
arguments: ‘–alsa-audio-device=hw:1,0’

also I got tts google work from this

Logged in as homeassistant user and tested with …

cvlc --vout none LRMonoPhase4.wav

… sound output is good.

The output of my aplay -l is…

**** Lista di PLAYBACK dispositivi hardware ****                                                                                
scheda 0: PCH [HDA Intel PCH], dispositivo 0: ALC662 rev3 Analog [ALC662 rev3 Analog]                                           
  Sottoperiferiche: 1/1                                                                                                         
  Sottoperiferica #0: subdevice #0                                                                                              
scheda 0: PCH [HDA Intel PCH], dispositivo 3: HDMI 0 [HDMI 0]                                                                   
  Sottoperiferiche: 1/1                                                                                                         
  Sottoperiferica #0: subdevice #0 

… so

 - platform: vlc
    name: HA Speaker
    arguments: '--alsa-audio-device=hw:0,0'

… must be the right config.

But still no audio on Home Assistant… I don’t remember after doing “what” the audio stop working, but I’m sure that before of a “certain point” my audio was playing.

From the log I saw that the event it’s fired…

2018-01-19 10:18:11 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service=play_media, service_data=entity_id=['media_player.speaker_1'], media_content_type=music, media_content_id=https://www.*******.online:8123/api/tts_proxy/1e4e888ac66f8dd41e00c5a7ac36a32a9950d271_it_-_google.mp3, domain=media_player, service_call_id=140706656706064-37>

… and the media_content_id if played from a web browse it’s okay.

1 Like

base_url has to be ip with port. no need https://www ( try put ddns.online:8123 without https://www) . Then you can test with tts google. just click on media player and type. it would be able to speak what you type.

No way… nothing is changed neither without https://… neither with numeric IP…

I mean if your base_url is https://www.dynamicname.online ( put the https://www away) the base_url will be
dynamicname.online:8123 <== ip with port no need https://www

to test it locally instead of dynamicname put the local_ip:port

after change restart your ha and test from your media player directly

tts

http:
  api_password: ***********
  base_url: *******.online:8123
  ssl_certificate: /home/****/.homeassistant/fullchain.pem
  ssl_key: /home/****/.homeassistant/privkey.pem 

Immagine

… same issue! nothing is changed… :sweat:

You press > no sound?

I see the different is the name of the speaker is different.

media_player:

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

you speaker name is speaker_1
but from media player I see name myspeaker

I’ve changed the name to myspeaker for test… maybe something is wrong with the underscore… but nothing… same “no audio”.

Uhm… I think no… how I can check?
The following are the attributes of the media player…

  "media_content_type": "music",
  "media_duration": 0,
  "media_position": 0,
  "is_volume_muted": false,
  "volume_level": 1,
  "friendly_name": "myspeaker",
  "media_position_updated_at": "2018-01-19T10:52:08.775600+00:00",
  "supported_features": 16909

also can you try set the language from ‘it’ to ‘it-IT’

… no I haven’t tried with “it-IT” but I’ve tried with no “language: it” at all.

When you test from Speaker. Type the word you want to test and press >
tts
my media player setting

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

my tts google

  • platform: google
    language: ‘en-uk’
    cache: true
    cache_dir: /tmp/tts
    time_memory: 300

for cache_dir: /tmp/tts <== you have to manually create
The language page support I check from here https://cloud.google.com/speech/docs/languages

The problem is the encryption! Let’s Encrypt broke the TTS service due to NAT loopback.

Tried Yandex, Pico and VoiceRSS… no way… no audio!
The strange thing are that Pico is running on local mode, so TSL, NAT and loopback should be excluded!

from my router, I forward port external 443 to internal 8123 (when I use let encrypt) also I forward external port 8123 to internal 8123.

currently I use
base_url: dns:8123 without http://www and without https://www this will be automatic forward to HA by router

first when i test tts google I try by local ip of HA and port
base_url: ha-internal-ip:8123 without http://www and without https://www

on tts google platform, for the cache_dir: /tmp/tts I create tmp folder manually in HA configuration directory.

Any way to make it work. I am also stuck with same issue.