I’ve been having the same issue. Not sure why it happened though. My TTS script has been working for at least 8 months and all of a sudden it stopped working.
This is the script that I’m using:
speech_processing:
alias: Speech processor (text-to-speech)
sequence:
- service: media_player.turn_on
data:
entity_id: media_player.squeezebox
- service: media_player.volume_set
data_template:
entity_id: media_player.squeezebox
volume_level: !include ../templates/volume_level.yaml
# Play the announcement sound.
- service: media_player.play_media
data:
entity_id: media_player.squeezebox
media_content_id: !secret sound.announcement
media_content_type: audio/mp3
- delay: >-
{% set duration = states.media_player.squeezebox.attributes.media_duration %}
{% if duration > 0 %}
{% set duration = duration - 1 %}
{% endif %}
{% set seconds = duration % 60 %}
{% set minutes = (duration / 60) | int % 60 %}
{% set hours = (duration / 3600) | int %}
{{ '{:0>2}:{:0>2}:{:0>2}'.format(hours, minutes, seconds) }}
# Play the text-to-speech message.
- service: tts.google_say
data_template:
entity_id: media_player.squeezebox
message: >
speech_message
# Turn off the Squeezebox when it is done playing the text-to-speech message.
- wait_template: "{{ states.media_player.squeezebox.state == 'idle' }}"
- service: media_player.turn_off
data:
entity_id: media_player.squeezebox
I’ve checked everything. The volume is up. It successfully plays the announcement mp3 file (which is a simple chime; also, there is sound here!), the squeezebox than ‘plays’ the google say mp3, but there is no sound!
I’ve even simplified my script to only contain the tts.google_say call and tried to do the same thing from the /dev-service page in Home Assistant. Both didn’t work.
When I grab the URL to the mp3 file and paste it in a browser, it does play fine. So, the mp3 is generated correctly. I also know that my speaker is working fine, since I can play anything on it except for mp3’s generated by tts.google_say.
I’m btw using Duck DNS together with Let’s Encrypt so I have SSL enabled. I’m also on the latest Home Assistant version 0.82.0.
Edit:
This is btw my TTS configuration:
tts:
- platform: google
cache_dir: /tmp/tts
language: 'nl'
And I do have base_url set in the http configuration.
I don’t know if it’s related or not but I can open the Home Assistant app on my phone and it looks fine.
If I click the 3-line menu bar at the top left and choose “Load Web UI” it tries to load the duckdns address eg MyHome.duckdns.org:8123, but it says “Unable to connect to Home Assistant”.
The weird thing is that in the app (which is working), when you click the 3 bar menu icon in the top left to expose the menu, the very top shows https://MyHome.duckdns.org:8123 so if there was an issue with the address, the icons wouldn’t work.
As for TTS via the app, if I click on the “office” speaker, the GHM in my office chimes as it becomes “alive” but the text isn’t heard.
I wonder if it has anything to do with now needing to pay a monthly fee (I have never understood what a “free” user doesn’t get compared to a subscription user).
Wait, you now need to pay for Google Translate (TTS) as well? I thought it was only for Maps, etc.
I just tried a simplified TTS script and noticed the following in my log:
[homeassi
stant.components.http.view] Serving /api/tts_proxy/0db21e1f678c7f39c20e0cef0b56da9fc7a0cf3
4_nl_-_google.mp3 to <ip_address> (auth: False)
Not sure whether the (auth: False) was always there, but for other calls I see (auth: True). Maybe this has something to do with the new auth providers? I’m using Duck DNS and SSL. I have no clue whether this has something to do with the issue, just putting this out there.
So, I just removed the ssl_certificate and ssl_key attributes from the http config and TTS seems to work again.
This might be an issue with my Squeezebox speaker. I’m using a Logitech Media Server to connect to that speaker. I did upgrade that server to the latest version recently, so perhaps that doesn’t work well with SSL / Google. It’s weird though, since it worked perfectly for months.
http:
# Secrets are defined in the file secrets.yaml
# api_password: !secret http_password
api_password: NotForAnyoneToKnow
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# ssl_certificate: /home/homeassistant/dehydrated/certs/myhome.duckdns.org/fullchain.pem
# ssl_key: /home/homeassistant/dehydrated/certs/myhome.duckdns.org/privkey.pem
base_url: myhome.duckdns.org:8123
# This site can’t provide a secure connection
**192.168.178.122** sent an invalid response.
* [Try running Windows Network Diagnostics](javascript:diagnoseErrors()).
ERR_SSL_PROTOCOL_ERROR
If I change the web address from https to http, I get my login screen. If I log into that, then I can open one of my GH units eg Office, and TTS works.
What I’m talking about is the card that reads:
It looks like your Home Assistant Cloud subscription has expired. Please check your account page to continue to use the service.
The reason I’m confused is that it says:
With the Google Assistant integration for Home Assistant Cloud you’ll be able to control all your Home Assistant devices via any Google Assistant-enabled device.
I gather that means I can voice control (using my GH/GHM’s) things like my Yeelight lamp.
In that case, I can still do this, so I’m unsure what a subscription does for me. $60 per year isn’t much but I don’t know what that gives me. Perhaps it means I can use encryption and have a HTTPS address but since I don’t currently pay, I can’t use HTTPS and that’s why TTS only works via HTTP and this would only work (I guess) for when I type something into TTS from a web page but not for a scripted response (eg “Someone at the front door”).
Ah ok, I’m not using Home Assistant Cloud at all, so can’t help you with that.
I just bought a Google Home Mini and started using that as my TTS speaker, which works fine. No problems at all with SSL.
I’m not using my Logitech Squeezebox speaker at the moment, since it still doesn’t work with SSL. I would still love to use it though, so that I can broadcast to both my Squeezebox and Google Home Mini. Really hoping someone has a solution.
I’m just setting up the tts for the first time, but I think I’m having the same problem. My HA is setup using https and the google assistant integration seems to work fine. BTW, I’m not using the subscription service. I setup the GA integration manually following the instructions. I can control my devices with no problem. If I go to one of the GH media player devices and click the 3 dots, I can type in text in the “tts” input field and that works fine as well. But if I go to the main page and click on the services button under developer tools and fill out the fields like this:
I see the popup in the lower left say “service tty.google_say called”, but nothing comes out of the speaker. My JSON above has been formatted for easy viewing, but in the input field, it’s all on one line.
If I’m trying to call it from the developer tools, is there a different way to specify it?
I haven’t actually tried it from an automation yet. I wanted to see it work from a manual call first.
I’m not an expert, but my configuration file works and looks like this:
automation:
- alias: 'Someone At The Front Door Daytime'
trigger:
platform: template
value_template: '{{states.switch.front_door_15.attributes.device_tripped}}'
# The Condition Syntax from https://www.home-assistant.io/docs/scripts/conditions/
condition:
condition: time
# At least one of the following is required.
after: '08:00:00'
before: '20:00:00'
# Text to Speech
action:
- service: tts.google_say
entity_id: media_player.whole_house_doorbell
data:
message: 'Motion Detected At The Front Door'
I don’t know anything about the developer tools and perhaps they do formatting differently. Mine is in my Configuration.yaml file and as you can see doesn’t have the curly brackets and uses single quote marks etc.
Yeah, I’ll try it in an automation and see if the result is the same. The reason I had to use JSON in the developer tools is because they just give you one line for the data and I don’t think I could do any kind of yaml there.
But I would like to figure out if anyone is getting it to work from the developer tools and what you enter into the input fields.
Hi @brucehvn , I was in the same boat as you 10 minutes ago.
It seems there was a problem with Google TTS platform but it has been solved in 0.83.2 as confirmed in this thread.
I didn’t want to update to a new version yet so I applied the patch mentioned here.
The next step was to enter in the developers tools this JSON (no message inside data, just message alone):
Thanks timseebeck. I upgraded to 0.83.2 and indeed it does work now, though I have to use the JSON format you describe which seems odd.
Using it in automations worked even before the upgrade, but did (and does) require the documented format (message inside data)
I had one quirk which also seems to be fixed by the 0.83.2 update. I have a speaker group that I created in the Google Home app which includes all 4 of my google home devices. When I had an automation that was supposed to announce on that media player, the first message would never be announced, though I would see the media player in the home screen come alive and say “playing”. A subsequent attempt to put a second message through would speak normally. The same was true just trying it through the UI, opening that media player, and typing in the text to say. The first message would not be heard, but the next message would. But so far it’s working now with 0.83.2
If you want to integrate the fix that was made for 0.83, it’s super simple. Just edit “/lib/python3.5/site-packages/homeassistant/components/tts/google.py” under your home assistant install directory, and change “1.1.2” to “1.1.3”. That’s it.
Guess I spoke too soon. There is still some weirdness when trying to play to the media_player.all_google_homes from an automation. Even with the cached file there, GH chimes, but the text doesn’t come through. Much like what the OP was posting. Putting multiple service calls in the automation, each targeting a specific GH seems to work ok.
I just did the update to 0.83.2 and on the web front end, I open the card for the Google Home Mini in the office and enter some text.
Other than the beep, I don’t get the text played.
I tried emptying my TTS folder and trying again, but no luck. I did a refresh of the TTS folder and no files showing after the 2 attempts following the deletion of the old files, if that helps.
EDIT: Solved
The issue was my security certificates. It had expired and when I tried to manually renew, it didn’t work.
I followed these instructions and my system was still having issues with the certificates.
Further investigations found that although I followed the instructions where it said:
Our Home Assistant user needs access to files within the letsencrypt folder, so issue the following commands to change the permissions.
Once I did that, I wasn’t getting errors on restart, nor did the HTTPS part in my web address become red and double scored through, and TTS began working again.
By chance, did you modify your base URL somewhere along the line?
I configured SSL and set the base URL to my DuckDNS domain name, but had to change it to my local IP to authenticate with another vendor’s site. That broke parts of Google authentication. Fortunately, I was able to change the base URL back after I got an authentication key from the other vendor so everything works again.