home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.77k stars 28.91k forks source link

Unable to cast TTS to Google Cast despite proper `external_url` set #88080

Open Ginden opened 1 year ago

Ginden commented 1 year ago

The problem

I have following configuration:

My Nest device is unable to play TTS messages (see log section).

It would be useful to force use of external URL in such case, or at least fallback to it.

What version of Home Assistant Core has the issue?

2023.2.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Google Cast

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Failed to cast media https://ha.internal.domain.example/api/tts_proxy/640ab2bae07bedc4c163f679a746f7ab7fb5d1fa_en_-_google_translate.mp3 from internal_url (https://ha.internal.domain.example).

Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

Additional information

No response

dshokouhi commented 1 year ago

what happens if you configure external_url under tts like the docs mention?

https://www.home-assistant.io/integrations/tts/

mcarter14777 commented 1 year ago

Do you use Nabu Casa? I was experiencing the same issues but found a setting in Settings>System>Network>Home Assistant URL and turned on the internet toggle with my nabu casa url. I can now cast text to speech again!

Ginden commented 1 year ago

@dshokouhi

what happens if you configure external_url under tts like the docs mention?

System fails with:

Invalid config for [tts.google_translate]: [external_url] is an invalid option for [tts.google_translate]. Check: tts.google_translate->external_url. (See ?, line ?). 

I also found undocumented and deprecated base_url under TTS config. Providing it fixes a problem, but I'm not sure when it will be removed.

Root issue is that Google devices seems to ignore local DNS server sometimes.

@mcarter14777

Do you use Nabu Casa?

No, I setup my own reverse proxy.

ChrisCarini commented 1 year ago

I, too, am experiencing the same issue as @Ginden.

Setting the base_url setting works for me, but my prior internet searches also told me this was being deprecated.

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

ChrisCarini commented 1 year ago

It would be nice to have confirmation if base_url is in fact being deprecated or not, and if so, what the replacement would be here.

thomasgeens commented 1 year ago

@ChrisCarini , I think you have your answer by now:

Configuration invalid! Invalid config for [tts.google_translate]: [base_url] is an invalid option for [tts.google_translate]. Check: tts.google_translate->base_url. (See ?, line ?).

home-assistant[bot] commented 11 months ago

Hey there @emontnemery, mind taking a look at this issue as it has been labeled with an integration (cast) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `cast` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign cast` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


cast documentation cast source (message by IssueLinks)

RouNNdeL commented 11 months ago

I'm facing the same issue. Setting the internal URL in HA network settings to be the same as the external URL fixed the problem.

I believe this is caused by the TTS integration trying the internal URL when the media player is on a local network.

In my case the Google device is not allowed to access the HA VLAN. Is there any other way to force the usage of the external URL for TTS?

issue-triage-workflows[bot] commented 8 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Ginden commented 8 months ago

My alarm stopped working, and we still have no response on this.

norsemangrey commented 8 months ago

I'm struggling with the same issue. I previously used this in the yaml configuration which was working fine:

# Text to Speech
tts:
  - platform: google_translate
    base_url: http://<ha-vm-ip-address>:8123
    service_name: google_translate_say
    cache: true
    cache_dir: /tmp/tts
    time_memory: 300

But now that this has been deprecated I am unable to get the TTS casting to my Google speakers to work.

I have tried installing the new Google Text to Speech integrationand and removed the old lines related to TTS services in the yaml configuration. Using the developer tools/services I have attempted to test the Speak service like this:

service: tts.speak
data:
  message: Testing Testing
  media_player_entity_id: media_player.living_room
  language: en-us
target:
  entity_id: tts.google_en_com

However, I only get a "ding" from the speaker and nothing else.

I read a mention somewhere of the new TTS service requiring a HTTPS URL, but I already have both my internal address and my external address set up with HTTPS.

image

Has anyone been able to find a solution / workaround for this?

killkuter commented 5 months ago

i 've the same issue

bug

killkuter commented 5 months ago

i 've solved my issue in configuration.yaml add server_port: 8123 in the section of the SSL certificat

Ginden commented 4 months ago

It seems like a core issue is with TTS, not cast.

Specifically, in homeassistant/components/tts/__init__.py line was

base = self.tts.base_url or get_url(self.tts.hass)

was replaced with:

base = get_url(self.tts.hass)

But function get_url prefers internal URL over external URL.

@emontnemery Can you suggest a solution how we can fix this?

issue-triage-workflows[bot] commented 1 month ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Ginden commented 1 month ago

It didn't work today's morning.

samuelabj commented 3 days ago

Ran into this tonight. https://github.com/home-assistant/core/issues/88080#issuecomment-1652359990 resolved it, but I'm guessing this is going to introduce latency issues in other areas.