SOLVED TTS Text to Speech / Google Translate won't work in Dutch

Hi,
I’m a newbie with HA. I started to work with HA only 3 days ago.
TTS works fine in the default language English but I’d like to use it in my native language: Dutch.

After some research I found I had to add ‘language’ to the configuration.yaml

Default entries:

Text to speech

tts:

  • platform: google_translate

After change:

Text to speech

tts:

  • platform: google_translate
    language: ‘nl’

I restarted HA, but the TTS langage remains English.
Have I missed something?
Thanks for your help

Do you also use Nabu Casa?

No, I don’t use the Cloud service.

do you see any errors?

btw, you dont need the language setting in the configuration at all.

simply using:

tts:
  - platform: google_translate
    service_name: google_say
    cache: false

and add the language you desire to the service:

      - service: tts.google_say
        data:
          language: >
            {{states('input_select.intercom_language')|lower}}
          entity_id: >
            {{states('sensor.intercom')}}
          message: >
            {{states('input_select.intercom_message')}}

Using template for all fields here, but you can replace that with fixed values. for the language: any of the google languages is supported… (so you can have a dutch message pronounced with an Italian accent.:wink:

btw, for using code in this forum, please show them formatted correctly using 3 backticks before and after the code block, or use the </> in the editor menubar

Hi,

Thanks for your reply and provided code but I really don’t understand what it means. I’m not a programmer, my apologies.

The only thing I want to do is tell Home Assistant to speak Dutch instead of English when using text to speech.

By copy and pasting your code, it should work in Dutch?
Where do I have to paste the code? Into configuration.yaml or somewhere else?

I’m really a newbie and trie to find my way. Any online resources to learn the basics?

Thanks!

Sorry to have confused you… my config uses templates in all data fields but you can use this too:

      - service: tts.google_say
        data:
          language: nl
          entity_id: media_player.your.player
          message: Dit is een test message

you can enter this in the developer-tools/service page

to see if it works alright.

my original point was, you dont need the language setting in the tts: section of configuration.yaml, since you can specify it in each service call. Or, as you can see in my config with template, vary according to specific needs through some extra inputs (which states are then templated into the tts service…)

docs: https://www.home-assistant.io/integrations/tts/ to start with

Hi,

First of all when I’ve added:

tts:
  - platform: google_translate
    service_name: google_say
    cache: false

to my configuration.yaml. When checking the configuration I got below errors:

Error loading /config/configuration.yaml: while parsing a block collection
  in "/config/configuration.yaml", line 21, column 3
expected <block end>, but found '?'
  in "/config/configuration.yaml", line 22, column 3

In the Developer Tools -> Services tts.google_say does not exist. I can see tts.google_translate_say.

Without adding any service, I changed the configuration.yaml to:

tts:
  - platform: google_translate
    service_name: google_translate_say
    cache: false

but the same errors remain while checking the configuration…

How odd…
are you sure line 21/22 is the tts line?

If you copied it correctly it should work as expected.

And since it doesn’t just yet, the service isn’t available in the services page. Got to fix this first…

Marius,

The chicken and the egg… What was first (read; what should be done first :wink:

I changed my configuration.yaml. For some reason this time no error while checking Restarted HA and went to the Develop Tools -> Services

Now indeed tts.google_say was in the list.

Made the entries with my Entity ID media_player.kitchen_display

This ID is a Google Mini. When activating ‘Call Service’ the Mini only gives a beep, no vocal message.

I went back to my Dashboard and tried what worked before by entering some text in ‘text to speech’ but again the speaker only gives a beep, before the changes I could hear my translated words in English…

Schermafbeelding 2020-12-27 om 22.27.15

Any suggestion?

well, depending on your instance you could need the external_url to be setup. are you by chance using a service like duckdns to reach your instance when away from your local network?

in which case it is useful (needed) to point HA to that resource, and a little trick (search for it on the forum here)

homeassistant:
  internal_url: !secret external_url
  external_url: !secret external_url

with the external_url being of the format:

external_url: https://yourdomain.duckdns.org:1234

of course, 1234 needs to be substituted with the port you actually use in your config.

btw, using the frontend interface doesnt allow you to set a language, in which case it probably defaults to the default language, and not dutch. if you so desire you either have to use that in the tts: config after all, or, when you use tts only in automated situations, with automations and scripts, use the service block I showed you, which has the language set in the data options

Hi Marius,

External URL (https) is configured and works fine but about the tts it still doesn’t work.

Into my configuration.yaml I have:

# Text to speech
tts:
  - platform: google_translate
    service_name: google_say
    cache: false

The text-to-speech feature in the mediaplayer default overview, or use of developer tools -> services gives the same result. The mediaplayer gives a beep, that’s all.

If I remove the lines

service_name: google_say
    cache: false

to have the initial configuration, it also doesn’t work anymore in English…

My TTS config:

platform: google_translate
cache_dir: <Temp DIR here>
language: nl
base_url: <My external URL>
service_name: google_say

Working as expected, notifications in Dutch.

3 Likes

Many thanks Pyvarex. It finally works!

2 Likes

yep, base_url can also be set in the tts configuration, though it should still work as I posted above, using the external_url in the homeassistant: hierarchy.

glad you got it working now, but you’ve ‘fixed’ your settings, making it less flexible for the services in automations and scripts to use.

My point in the opening reply was you dont need that in the main config for tts: since you can set it in the service and use it flexibly. If you don’t need that, this would work too.

One point to clarify that may confuse readers of this thread - to the best of my knowledge, the “language” option for say does not actually translate. It just affects the Google voice chosen to speak the message with.

In other words, if you pass a message written in English but invoke say with language set to “nl” it will speak the English message in English but with a Dutch accent. If you want the message spoken in actual Dutch, you need to send in the message in Dutch, not English.

Where’s is that saved? In configuration.yaml?

i get a NL is not supported

Make ik nl small letters