Fix, improve input validation and add tests to ClickSend tts (#23740)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
CharlB 2022-10-24 18:42:46 +02:00 committed by GitHub
parent a5854a0e71
commit 72c602a06f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,7 @@ ha_integration_type: integration
The `clicksend_tts` platform uses [ClickSend](https://clicksend.com) to deliver text-to-speech (TTS) notifications from Home Assistant.
Go to your [ClickSend Dashboard](https://dashboard.clicksend.com) section and create your new project. After creating your project, you should now be able to obtain your `username` and `api_key`.
After creating your account, you should now be able to obtain your `username` and `api_key` [here](https://dashboard.clicksend.com/account/subaccounts).
To add ClickSend to your installation, add the following to your Home Assistant `configuration.yaml` file:
@ -29,10 +29,10 @@ notify:
name:
description: Setting the optional parameter name allows multiple notifiers to be created. The notifier will bind to the service notify.NOTIFIER_NAME.
required: false
default: ClickSend
default: clicksend_tts
type: string
username:
description: Your username.
description: Your username (probably your email address).
required: true
type: string
api_key:
@ -40,15 +40,11 @@ api_key:
required: true
type: string
recipient:
description: Recipient phone number. This is the phone number that you want to call and notify via TTS (e.g., `09171234567`).
description: An [E.164](https://en.wikipedia.org/wiki/E.164) formatted phone number, like `+14151234567`. This is the phone number that you want to call and notify via TTS, see [ClickSend Documentation](https://developers.clicksend.com/docs/rest/v3/#Send-Voice-Message) for more info.
required: true
type: string
caller:
description: Caller phone number. This is the phone number that you want to be the TTS call originator (e.g., `09181234567`). If not defined the recipient number is used.
required: false
type: string
language:
description: The language you want to use to convert the message to audio. Accepted values are found in the [ClickSend Documentation](https://clicksend.docs.apiary.io/#reference/voice/voice-languages).
description: The language you want to use to convert the message to audio. Accepted values are found in the [ClickSend Documentation](https://developers.clicksend.com/docs/rest/v3/#Send-Voice-Message).
required: false
default: en-us
type: string
@ -59,4 +55,17 @@ voice:
type: string
{% endconfiguration %}
To use notifications, please see the [getting started with automation page](/getting-started/automation/).
### Usage
ClickSend is a notify platform and thus can be controlled by calling the notify service [as described here](/integrations/notify/). It will send a notification to the E.164 phone number you configured as **recipient**.
```yaml
alias: "The sun has set"
trigger:
- platform: sun
event: sunset
action:
- service: notify.clicksend_tts
data:
message: "The sun has set"
```