Sonos and TTS (Google) fails

I use TTS to tell me if the freezer or garage door is open.

It has been working fine for a long time. Very recently it has stopped working on my Sonos speakers. It still works on my Google Home Mini so the TTS works fine.

I have not changed anything - it just stopped working. I am running core core-2021.8.7 and supervisor supervisor-2021.06.8. I believe it might have stopped working after upgrading til core-2021.8.x
The error I get

Logger: homeassistant.components.media_player
Source: components/media_player/__init__.py:995
Integration: Medieafspiller ([documentation](https://www.home-assistant.io/integrations/media_player), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+media_player%22))
First occurred: 9.41.25 (1 occurrences)
Last logged: 9.41.25

Error retrieving proxied image from http://192.168.1.160:1400/getaa?s=1&u=x-sonos-http%3acatalog%253atrack%2540%257ecatalog%252f1387%252ftracks%252f229606779.mp4%3fsid%3d175%26flags%3d8224%26sn%3d3

The media_player for Sonos works fine. I can start, stop, adjust volume etc.

Does anyone experienced the same or have any suggestions how to find the error?

1 Like

i have the same issue. i cant figure out whats wrong. i thought it was because duckdns was getting DDOS attacks… but i think thats over… and still nothing.

I run HA docker version 2021.8.6. There were no sonos changes in 2021.8.7, so the two are the same in that respect. Google TTS to my Sonos speakers works just fine. I know Sonos will not play anything sent to it from a non-secure (ie. HTTP) source. I had to setup a DNS redirect for my HTTPS URL to my HA internal IP for it to work.

Your error almost looks like the Sonos media player integration is balking at an insecure URL.

I hope you are right :slight_smile:

I will try it in the weekend and post if it went well.

For how long have you had the issue?

Hello,

I would say, about 2 weeks?

I have the same problem. tts has stopped working on my sonons after updates of HA. Have you managed to solve it?

I think this may be isolated to you guys, I have a similar setup (Google TTS to Sonos for alerts) and mine is working fine on all latest revisions of Supervisor and HA. According to the error message you shared, you need to make sure you can connect via port 1400.

I have TCP 80, 443, 445, 2869, 3400-3401, 3445, 3500, 4444, and 1400-1500 open to my speakers. I have found Sonos to be very finicky around accessing ports, if you have one blocked that it wants it’ll complain.

See here for more detail (and UDP port list): Sonos Support

I do not think the ports has to be open on the WAN side. I have never had them open - I have just one LAN, where everthing local can reach eachother freely. Sonos has been working fine for many years.

No, not yet :slight_smile:

A bit of progress.
When I type something to say Home Assistant write a file as it is suppose to. Sonos however fails to play it. It says, that it can not play the file as the connection to Home Assisant vanished/failed.

Mayby it is a port issus at SpikeyGG suggested. I will try is.

Sonos can only play from HTTPS sources. Make sure HA is setup correctly with SSL. Have the Sonos app open on a phone and HA open in a browser or app on another device. Send the TTS from HA and see what the Sonos app says the source link is.

Yeah, I wasn’t talking about WAN side. If you don’t block anything locally, you should be fine.

I tried this and then get this message on the Sonos app.
can not play a94a8xxxx_sv_google_translate.mp3-lost connection to xxxx.duckdns.org:8123.

I have not made any changes to the settings for SSL or anything else other than the updated HA.

Sonos App says the same at my place.

Web-interface to Sonos:

http://192.168.1.124:1400/tools.htm

I did a NSlookup and got this output:

<mydomain>.duckdns.org: dns (138 ms) -> <external IP> mdns (0 ms) -> failed netbios (0 ms) -> failed

I am also sure, that Lets Encrypt (SSL) is working fine and all the right ports are open.

Pinging from the web-interface (Sonos):

running /bin/ping -c 3 <mydomain>.duckdns.org
PING <mydomain>.duckdns.org (<external ip>): 56 data bytes
64 bytes from <external ip>: seq=0 ttl=64 time=1.341 ms
64 bytes from <external ip>: seq=1 ttl=64 time=1.258 ms
64 bytes from <external ip>: seq=2 ttl=64 time=1.173 ms

--- <mydomain>.duckdns.org ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 1.173/1.257/1.341 ms

And the traceroute:

running /usr/bin/traceroute <mydomain>.duckdns.org
traceroute to <mydomain>.duckdns.org (<external ip>), 30 hops max, 38 byte packets
 1  <external ip> (<external ip>)  0.916 ms  3.424 ms  0.912 ms

Don’t know what to say then… mine is working fine. I just remember when I was setting up Sonos and TTS a year ago that it did not like an http address and that “lost connection” message was exactly what I was getting. I could not push anything to Sonos until I setup a DNS loop back/redirect in my DNS server to redirect any internal connections from my external HTTPS to the internal IP. Also, I don’t use duckdns, rather I use a lets encrypt certificate on my Synology and share that with the HA container. So maybe there were some changes to duckdns recently? Or maybe something changed from the ISP? Going back to the ports comment, maybe check that HA is externally accessible and specifically the www folder or whichever folder holds the TTS audio files. Take the URL that Sonos is supposed to be playing and put it into a web browser. The file should play there or may give you a security warning or may not be found. The way Sonos handles media is HA does not send the audio file, rather HA tells Sonos “I want you to play this” and sends a link to where the file is. Sonos validates the URL, goes there and then retrieved the file. If that file is not accessible due to network issues, security issues, or misconfigured file sharing, it will error out.

I tried to ping homeassistant.local and found that it only returned the IPv6 adress.

I setup a DNS server and added homeassistant.local to point at the local IP of the Home Assistant.

I can now ping and do a NSlookup on Sonos (web-interface). Now I get the local IPv4 adress

homeassistant.local: dns (9 ms) -> 192.168.1.XX mdns (1001 ms) -> failed netbios (0 ms) -> failed

How ever it did not fix the error. Still the same error message.

I tried to change the base_url under tts: in the configuration.yaml to the local HomeAssistant IP. That also did not help.

Just to add I’m getting the same issue. Snapshot and restore seem to function fine, as well as throwing music up on it. However no TTS plays. This has been working fine previously for well over a year.

I have the same problem since version 2021.8.7. It did work fine before.
Now the tts wont play. Sonos cannot connect.
No audio file generated in tts folder. I have removed the old files.

Update: Tested with mp3 file in www folder, same issue.
Problem is also described in: Sonos media_player.play_media can't access local files · Issue #55223 · home-assistant/core · GitHub

Update2: When I host the mp3 file on another home assistant also with https, but without duckdns the mp3 plays fine.

Same problem here. It worked until Sunday 22nd of August, which means it worked with 2021.8.8.

EDIT: I am using duckdns.org, as both internal and external URL, and the FQDN is resolved to the internal IP for HA in my DNS, if that has anything to say. But again, this has been the case for a long time now, and it just recently stopped working.