Add google translate config flow (#27886)

This commit is contained in:
Martin Hjelmare 2023-06-26 19:06:56 +02:00 committed by GitHub
parent 284642c81a
commit 8d69ce3002
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,36 +8,16 @@ ha_iot_class: Cloud Push
ha_domain: google_translate
ha_platforms:
- tts
ha_config_flow: true
ha_integration_type: integration
---
The `google_translate` text-to-speech platform uses the unofficial [Google Translate text-to-speech engine](https://translate.google.com/) to read a text with natural sounding voices. Contrary to what the name suggests, the integration only does text-to-speech and does not translate messages sent to it.
## Configuration
To enable text-to-speech with Google, add the following lines to your `configuration.yaml`:
```yaml
# Example configuration.yaml entry
tts:
- platform: google_translate
```
{% configuration %}
language:
description: "The default speech language to use."
required: false
type: string
default: "`en`"
tld:
description: "The default Google domain you want to use to choose dialect."
required: false
type: string
default: "`com`"
{% endconfiguration %}
{% include integrations/config_flow.md %}
Check the [complete list of supported languages](https://translate.google.com/intl/en_ALL/about/languages/) (languages where "Talk" feature is enabled in Google Translate) for allowed values.
Use the 2-digit language code which you can find at the end of the URL when you click on the language name.
Use the 2-digit language code which you can find at the end of the URL when you click on the language name.
Check the [complete list of supported tld](https://www.google.com/supported_domains) for allowed TLD values. This is used to force the dialect used when multiple fall into the same 2-digit language code(i.e., *US, UK, AU*)
@ -60,21 +40,14 @@ You can also use supported BCP 47 tags like the below or the 2-2 digit format fo
|es-es|es|es|
|es-us|es|com|
## Full configuration example
A full configuration sample including optional variables:
```yaml
# Example configuration.yaml entry
tts:
- platform: google_translate
language: "de"
tld: com
```
## Service say
<div class='note'>
The `google_translate_say` service can be used when configuring the legacy `google_translate` text-to-speech platform in `configuration.yaml`. We recommend new users to instead set up the integration in the UI and use the `tts.speak` service with the corresponding Google Translate text-to-speech entity as target.
</div>
The `google_translate_say` service supports `language` and also `options` for setting `tld`. The text for speech is set with `message`. Since release 0.92, the service name can be defined in the configuration `service_name` option.
Say to all `media_player` device entities:
@ -123,7 +96,7 @@ data:
message: "May the force be with you."
language: "en"
options:
tld: co.uk
tld: co.uk
```
With a template: