DuckDns Let's Encrypt and TTS for Sonos speakers - cannot connect to external HA url

Hi, trying to get the TTS to work with my Sonos speakers…

I’m using the HA config below. The issue is that the Sonos speaker fails to connect to HA using the external url. Does anyone have suggestions on how to solve this issue?

The error I get is:
"Could not play <URL>.mp3, cannot connect to mydomain.duckdns.org:8123

File: /config/configuration.yaml

# Duck DNS and Let's encrypt certs
http:
  server_port: 8123
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem

homeassistant:
  external_url: "https://<mydomain>.duckdns.org:8123"
  internal_url: "http://<mylocalIP>:8123"

Hi @BartekSt,

From here HTTP-01 challenge, of the Challenge Types - Let's Encrypt, states
“The HTTP-01 challenge can only be done on port 80.”
The " implementation of the HTTP-01 challenge follows redirects, up to 10 redirects deep. It only accepts redirects to “http:” or “https:”, and only to ports 80 or 443. It does not accept redirects to IP addresses. When redirected to an HTTPS URL, it does not validate certificates (since this challenge is intended to bootstrap valid certificates, it may encounter self-signed or expired certificates along the way)."

Hi @anon55355842, I really appreciate that you spend time to answer my topic. To be honest I just did the setup for my DuckDNS + Let’s encrypt stuff using a tutorial a couple of years ago without digging any deeper into the details. This means that I don’t have that much knowledge about Let’s Encrypt… yet :slight_smile:

What do you think the issue is? I have tried to set the home assistant “internal_url” to “https://.duckdns.org:8123” as well without any luck.

Just want to mention that I port forward the external 443 port to 8123 in my router.

I can reach my HA from outside my network using https and DuckDNS domain with the settings I have but internally the Sonos speakers can’t connect to my HA for some reason.

BR
@BartekSt

1 Like

Hi @BartekSt,

Is the external Port 80 redirected to something internal that can answer the

Instead of starting a new thread, I’ll post here.

I am in the same situation as the OP, and like them I’m not familiar enough with ports, forwarding, etc, to understand exactly what’s going on and how to fix it. I just know that since connecting via DuckDNS and thus having a HTTPS URL instead of HTTP, the TTS commands never work, regardless of the target speaker (Nest Mini, Sonos, Nest Hub 2). Anyone able to walk me through the solution will get my everlasting thanks! :wink:

If this can help anyone with the same problem, I fixed it yesterday by asking Perplexity AI. It recommended that I add a few lines to configuration.yaml and it solved it, I can now send TTS messages to Google and Sonos speakers without problem.

I simply added:

tts:
  - platform: google_translate
    base_url: "http://192.169.x.xxx:8123"

That’s all!