Sonos TTS Not Working

I added Google TTS and Sonos to Hass. TTS plays through web browser just fine with media tab. Just spins for a second when trying to play through speakers. TTS is not heard through speakers. Nothing is posted to the logs. Using two Era 100s in stereo pair. Ports 1400 and 1433 are unblocked from IoT to hass dmz vlans. Here is my test code put into the developer tools:

service: tts.speak
metadata: {}
data:
  cache: false
  media_player_entity_id: media_player.bedroom
  message: test
target:
  entity_id: tts.google_en_com

Any ideas why this isn’t working?

First a note to remember for the future. The term HASS means hate in German, so the Home Assistant Project has not used that anywhere a customer will see it for 4 or 5 years. There are some internal code references that have not been converted yet and that gets fixed as things are edited.

Yikes! I was curious how that term just drifted out of existence… Good to know for the future.

I read over the page you linked and the one for the google translate integration multiple times earlier and again just now and I’m not sure what I’m doing wrong. I ran the exact code from the example and it did not work:

service: media_player.play_media
target:
  entity_id: media_player.bedroom
data:
  announce: true
  media_content_id: >
    media-source://tts/cloud?message="I am very loud"
  media_content_type: "music"
  extra:
    volume: 80

I’m trying to understand what is going on here. //tts/cloud is supposed to be an api endpoint on the HA server that publishes the audio file? Do I have to change the “cloud” to use google translate seems like that might be referring to the nabu casa cloud speach service.
Also is the speaker retrieving the audio file from the server or is the server pushing it to the speaker? My ssl cert is only trusted outside the home when it goes through cloudflare. Only Macs, Windows, iOS and Android which have the CA installed can access the server with no issues internally. Could that be holding it up?

This is the default if you are not buying nabu casa: Google Translate text-to-speech - Home Assistant.

i think the yaml in your first post looks correct. i suspect it’s not a yaml issue but may be configuration issue w/ your sonos. are you able to stream a media file from home assistant to your sonos using a url like this:

service: media_player.play_media
target:
  entity_id: media_player.bedroom
data:
  announce: true
  media_content_type: "music"
  media_content_id: "http://192.168.1.50:8123/local/sound_files/doorbell-front.mp3"
  extra:
    volume: 20

(you need to make sure the url is valid for your setup)

I had to setup a media folder in my configuration to test this. I dropped a mp3 in there and I see it in the media browser but I couldn’t figure out how to craft a working url for it. When I put https://domain/media/Flying%20-%20Track%20Tribe.mp3 or https://domain/local/media/Flying%20-%20Track%20Tribe.mp3 or https://domain/local/sound_files/Flying%20-%20Track%20Tribe.mp3 into Firefox I just got a 404 error. The media folder is named media. However I suspect this isn’t going to work anyway. My Sonos aren’t going to trust the ssl cert when trying to stream that file if HA is just telling Sonos to stream it over https. Am I correct that is what is happening when calling the TTS service? Any ideas of how I can push the data to the Sonos instead of having Sonos download it? Probably isn’t but thought I’d ask. I doubt there’s any way to get Sonos to trust my internal CA. So I will have to poke a hole in the firewall to allow Sonos to reach HA directly on http:8123 or whatever.

files put in your /config/www folder will be available in http://192.168.1.50:8123/local/

i would test a media file there and point sonos to that www folder… just for the test.

That did work with http on port 8123 which I had to put a hole in the firewall for. So is this the same way that the tts service transports the announcements? How do I get the Sonos speakers to pull the announcement using the custom protocol and port?

i’m not an expert in this but it looks to me like the tts mp3 files are stored in /config/tts, which i think is exposed in a similar way. if you needed to punch a hole through for it in the other case, i suspect you’d need to do something similar here.

I can punch a hole but the problem is I think the tts.speak service is still sending the regular port and protocol to sonos which is https and sonos won’t connect to that.

So what do others with HTTPS do for TTS on Sonos? I can’t be the only one.