Sonos and TTS (Google) fails

It is a bit strange that the problem did not start at the same time for us.

I am going to report it as an issue at core since I can not figure out where the issue is caused.

1 Like

Same issue for me.

I am having the same issue since the last update, before it worked flawlessly. I already checked firewall, internal/external link, Sonos media player works well from Home assistant, TTS file is being created, TTS works on google mini speakers, but Sonos just won’t play them… Running out of ideas

It’s working for me now.

Follow this guide: The easiest way to secure Home Assistant with HTTPS | dummylabs.com

And the last thing that did the trick was adding the below text to configuration.yaml
(in http section)

  use_x_forwarded_for: true
  trusted_proxies:
    - 172.30.33.0/24

This do not seem to be working for me. Same error.

However I have not changed my SSL since I use the DuckDNS add-on, where you only get a token. This can not be used with the Nginx Proxy Manager (as far as I can see)

This is no longer a Sonos or a TTS issue. This is a DuckDNS/Nginx/HTTP configuration issue. My suggestion is to read some of the changes and specifically breaking changes of the past few major versions of HA (ie 2021.6, 2021.7, 2021.8) and if you run HA Supervised or HAOS, the supervisor and HAOS changes as well.

Hello,
Can you tell me exactly where to look on the information? I am completely Lost :frowning:

1 Like

I have given up on TTS. Instead I have recorded my own MP3 announcements using the website https://ttsmp3.com/ - excellent range of languages and accents. If you save the files somewhere in the Sonos Music Library and make them Sonos favourites you can simply play them by filename.

This nags me to turn off the Xbox at 1am:

  action:
  - service: sonos.snapshot
    data: {}
    entity_id: media_player.study
  - service: media_player.volume_set
    entity_id: media_player.study
    data:
      volume_level: 0.4
  - service: media_player.select_source
    target:
      entity_id: media_player.study
    data:
      source: xbox_off_1.mp3
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - service: sonos.restore
    data: {}
    entity_id: media_player.study

Edit: The restore part of the automation above will not work if you are playing a playlist - the sonos.snapshot service does not capture playlist details. Instead you might try:

  action:
  - service: sonos.snapshot
    data: {}
    entity_id: media_player.study
  - service: media_player.volume_set
    data:
      volume_level: 0.4
    entity_id: media_player.study
  - service: media_player.play_media
    target:
      entity_id: media_player.study
    data:
      media_content_id: http://homeassistant.local:8123/local/sounds/xbox_off_3.mp3
      media_content_type: music
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - service: sonos.restore
    data: {}
    entity_id: media_player.study

Your .mp3 announcements should be stored in the directory config/www/… in HA.

1 Like

TTS up and running again. This solved it for me.

https://community.home-assistant.io/t/nginx-and-duckdns/262579

Then follow the dummylabs guide posted by Mackan.

If you get “400 bad request” when testing “basic HTTP access”.
https://community.home-assistant.io/t/home-assistant-400-bad-request-docker-proxy-solution/322163

2 Likes

Very strange. I don’t use Nginx and I don’t have any 400 bad request errors. Everything else works fine - is anyone else just using Duckdns and having this problem with Sonos TTS?

Same problem here. After installing DuckDNS sonos stop working for playing any mp3 behind my domain.duckdns.org.
I’m start thinking that this can be a problem with router nat loopback, where it recognize that the domain is inside your network and change the public ip for the private one to avoid going outside.
This for sure will cause https handshake domain validation to fail.
I will try to find that option in my router and check with wireshark also.

what i found out last night. is that if you are able to have a HTTP webaddress for local, and https for external access, it works.
today i will have more findings.

How do you make that work? I cannot figure out your settings for internal and external URL - will you share? Or am I on the wrong track? :slight_smile:

if you follow @Perka82 reply it will work. for me it didnt because when i try to create an new SSL it fails… I believe because of the Port forwarding on the router. But try it . thats what made me realize the issue for me.
But today i have my IT guy come in and Help me. After my findings, ill explain it all in my own way. I am not a Tec Guy. im just a normal guy trying to survive in this tec world :slight_smile:

2 Likes

I have solved the problem by adding the lines to the http section:

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.30.32.0/24

You can find the Hassio internal ip-range by looking into the Supervisor - Multicast logging.
example: mdns-repeater (6): dev hassio addr 172.30.32.1 mask 255.255.254.0 net 172.30.32.0

i have also solved my issue. and that was one of the options. if someone else needs help with this, let me know.

I added the below to the http section:

use_x_forwarded_for: true
trusted_proxies:
- 172.30.32.0/24

But still TTS is not working through Sonos. Could it be because of indentation?

I am using Duckdns with Let’s encrypt.

After following @Perka82 recommendation of installing Nginx as reverse proxy finally working for me also.

In my case I can confirm I have NAT loopback in my router but this solution seems to work with this with no problems.

1 Like

@Soccs - How do you make that work? I cannot figure out your settings for internal and external URL - will you share a picture from you config?

Same problem. I am also using Duckdns with Lets Encrypt