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
71.54k stars 29.91k forks source link

Can no longer select another tts language from a script #113931

Closed Mariusthvdb closed 5 months ago

Mariusthvdb commented 6 months ago

The problem

used to have scripts below select a language, a gender, a player and a message.

Seems gender is now deprecated, so I took that out.

However, selecting a language in my Dashboard (multi language users here)

Scherm­afbeelding 2024-03-21 om 11 47 13

no longer works on any other language than Dutch (my local settings).

using another throws below errors. same for Dev tools services, can only select nl-NL successfully, any other language doesnt play (and throws the errors)

What version of Home Assistant Core has the issue?

2024.4.0.dev20240321

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Cloud

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

- service: tts.cloud_say
        data:
          cache: false
          language: >
            {{states('sensor.tts_language')}}
#           options:
#             gender: >
#               {{states('input_select.tts_gender')|lower}}
          entity_id: >
            {{states('sensor.intercom')}}
          message: >
            {% set language = states('input_select.intercom_language') %}
            {{message_nl if language == 'Nl' else message_en}}

Anything in the logs that might be useful for us?

Logger: homeassistant.components.cloud.tts
Bron: components/cloud/tts.py:262
integratie: Home Assistant Cloud (documentatie, problemen)
Eerst voorgekomen: 11:41:01 (1 gebeurtenissen)
Laatst gelogd: 11:41:01

Voice error: Unsupported voice ColetteNeural for language id-ID

Logger: homeassistant.components.tts
Bron: components/tts/__init__.py:1016
integratie: Text-to-speech (TTS) (documentatie, problemen)
Eerst voorgekomen: 11:41:01 (1 gebeurtenissen)
Laatst gelogd: 11:41:01

Error on load tts: 9a7dafebcced599ece17a1688a96b18fdec4c342_id-id_11e6d54adb_cloud not in cache!

Logger: homeassistant.components.cast.media_player
Bron: components/cast/media_player.py:411
integratie: Google Cast (documentatie, problemen)
Eerst voorgekomen: 11:41:01 (1 gebeurtenissen)
Laatst gelogd: 11:41:01

Failed to cast media http://192.168.1.61:[port]/api/tts_proxy/9a7dafebcced599ece17a1688a96b18fdec4c342_id-id_11e6d54adb_cloud.mp3 from internal_url (http://192.168.1.61:[port]). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

Additional information

the above Cast error seems odd, as the Dutch notification does not throw an error, and proves the device is reachable

also note the error on cache, while I have set cache: false on all notification services

It does work in the Cloud settings page, where another voice is auto selected based on the language. Also proves the devices are reachable

Aware there is this https://github.com/home-assistant/core/pull/112256, but if that means users (so non-admins) need to go into the system settings for Cloud to change a tts language/voice, that seems very peculiar.

besides, considering several emergency notifications (fire, CO, Alarm) are multi lingual scripted in my Home, and done so via these simple scripts, I hope there is a way to get the same result as before: setting at least a language via backend scripting/automations

home-assistant[bot] commented 6 months ago

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

Code owner commands Code owners of `cloud` 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 cloud` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


cloud documentation cloud source (message by IssueLinks)

MartinHjelmare commented 6 months ago

Here are the supported voices for Indonesian: https://github.com/NabuCasa/hass-nabucasa/blob/599287174153d49c0b4121d42536fb0967cb3ea3/hass_nabucasa/voice.py#L490-L493

Maybe the selected language is not what you're aiming for?

Mariusthvdb commented 6 months ago

thanks, I did find those voice names via the 'Test' config/cloud/account page in the UI. any other spot in dev tools cant make that happen (even the example values in the service tool error)

What I was (am ) trying to do is select/set a language in a script (the buttons basically execute the srcript with that specific language) before, Gender was also stated in the script, and that needs to be replaced now with a voice name depending on the language.

Not setting a voice name results in the error, because it uses the default voice set in the UI, and that is only a valid voice for a single language, and not for the dynamic language selection.

Cut it short, there is now no longer an option to select a language in a script, unless we could do this somehow, and not have to specify an actual voice name:

- service: tts.cloud_say
  data:
    cache: false
  language: >
     {{states('sensor.tts_language')}}
   options:
     voice: default_for_the_selected_language
   entity_id: media_player.xyz
   message: >
      {% set language = states('input_select.intercom_language') %}
      {{message_nl if language == 'Nl' else message_en}}

even when doing this, and a green check is shown:

service: tts.cloud_say
data:
  cache: false
  message: This is a text message
  language: id-ID
  entity_id: media_player.googlehome_hub
  options:
    voice: none
    gender: none # also without this

the errors persist, and nothing is playing.

if I leave the voice: blank (which would be None) there is an error it cant execute the command at all

service: tts.cloud_say
data:
  cache: false
  message: This is a text message
  language: id-ID
  entity_id: media_player.googlehome_hub
  options:
    voice:

this works:

service: tts.cloud_say
data:
  cache: false
  message: This is a text message
  entity_id: media_player.googlehome_hub