TTS Transport Adaptor¶
| Transport ID | Source | Requirements | Optional |
|---|---|---|---|
tts | tts.py | TTS Integration | - |
Announce, or speak, a notification using one of Home Assistant's built-in Text-to-Speech integrations. By default, it uses tts.home_assistant_cloud from Nabu Casa if present, or else the first tts entity found, though any supported tts can be chosen. It also supports the Android Companion App TTS
Example¶
Since tts never auto-selects (see Discovery below), name the tts delivery explicitly and give it one or more media_player targets:
- action: supernotify.notify
data:
message: "Someone is at the front door"
delivery:
tts:
target:
- media_player.kitchen_speaker
- media_player.living_room_speaker
The resulting action call from the adaptor looks like:
service: tts.speak
target:
entity_id: tts.home_assistant_cloud
data:
media_player_entity_id:
- media_player.kitchen_speaker
- media_player.living_room_speaker
message: "Someone is at the front door"
A scenario can select tts the same way, instead of naming it on every call - see Scenarios.
Text-to-Speech Integration¶
This integration automatically sets the action to tts.speak and limits the data section to the supported values, cache, language and options.
The action can be overridden to an older platform-specific action, like tts.cloud_say. These target the media_player entities directly, with no tts entity.
By default (standard) the message is spoken, or the title if there's no message. Set the message_usage option to combine_title to speak the title then the message, use_title to speak only the title, or message_only to never fall back to the title.
Choosing the TTS Provider¶
Without a tts_entity_id option, tts.home_assistant_cloud is used if it exists, otherwise the first tts entity found. If there are no tts entities at all, the delivery is skipped, with a warning in the log.
Changing the Action¶
The resulting action call looks like:
action: tts.cloud_say
target:
entity_id:
- media_player.kitchen_speaker
data:
message: "Someone is at the front door"
Under the Hood¶
The Home Assistant TTS Integration calls the tts_entity_id to generate an audio file from the text, and then uses the media_player virtual integration to play this audio file. The Entity Platform (see Entity Architecture) creates jobs per entity for this - not per platform, so there can be a delay between each device making its announcement. It does however try to preserve the order in which the media_player entities were listed.
Android Companion App¶
If a mobile_app_XXXX target is passed to this transport, it will check if its an Android ( or more precisely not an Apple) mobile app, and generate an action call like:
action: notify.mobile_app_my_pixel
data:
message: "TTS"
data:
tts_text: "This is the notification message"
Set media_stream in the notification or delivery data, for example alarm_stream or alarm_stream_max, to choose which Android audio stream is used. It's passed inside the inner data, alongside tts_text.
The targets can be skipped if device discovery is switched on in the delivery configuration, in which case every notification will be announced on every Android companion app unless overridden. This example uses the delivery_defaults at the Transport level, which changes the defaults for all Deliveries. By default, the tts adaptor filters out Apple devices, which don't support TTS notifications, using the device_manufacturer_select option, and further filtering can be made in the options for model, manufacturer, label and area (see Table of Options for the list of options and the include/exclude syntax).
Media Player and Android targets can be combined in one call - the tts transport will work out which calls to make.
Being Pickier¶
Use the device select controls to narrow down the targets ( you can also select by manufacturer, operating system, label, area or a combination):
Voice specific message¶
Use spoken_message in the notification call to provide a different message for a voice notification than used for other transports like email or mobile push.
Alternatives¶
For Amazon Echo devices, text-to-speech is also available via the Alexa Devices and Alexa Media Player transport adaptors.
To get canned sounds rather than speech, use the Chime transport adaptor.
Discovery¶
Delivery (explicit selection). If the tts.speak service is available and at least one media_player entity exists in the house, and no tts delivery is defined, a tts delivery is generated automatically — but since a media_player target has no automatic mapping to a recipient, it only fires when selected explicitly (data: {delivery: [tts]} or a scenario), not by default.