Skip to content

chime_tts.say_url

Nimrod Dolev edited this page Jan 11, 2024 · 8 revisions

chime_tts.say_url Service

The chime_tts.say_url service returns a publicly accessible URL to the MP3 file generated by the chime_tts.say service, as well as the generated MP3's duration:

Service call:

service: chime_tts.say_url
data:
  chime_path: toast
  message: May I have your attention, please?
  tts_platform: google_translate
  language: en
  tld: com.au

Result:

{
  "url": https://{YOUR-HOME-ASSISTANT-ADDRESS}:8123/local/chime_tts/ftc_c0jb.mp3
  "duration": 3.02
}

Parameters (see chime_tts.say)

The chime_tts.say_url service behaves exactly the same as the chime_tts.say service and accepts the same parameters with the exception of all audio playback parameters such (as media_player targets and other playback-related parameters) as there is no audio playback.

Please refer to the documentation for the chime_tts.say service to learn more about how the parameters are used.

Use cases may include playing Chime TTS audio on media_players such as Alexa (see below).

Alexa Speakers

For MP3 playback on Alexa speakers, you must use a publicy available MP3 file which also matches Alexa's MP3 format requirements.

This can be done using Chime TTS in a sequence:

  1. Call the chime_tts.say_url service with the audio_conversion parameter set to "Alexa". This will result in a publicly accessible MP3, converted for Alexa playback.
  2. Call the notify.alexa_media service, passing the URL to your MP3:
sequence:
  - service: chime_tts.say_url
    response_variable: chime_tts
    data:
      message: May I have your attention, please?
      tts_platform: google_translate
      audio_conversion: Alexa
      language: en
      chime_path: toast
      tld: com.au
  - service: notify.alexa_media
    data:
      message: <audio src="{{chime_tts.url}}"/>
      target:
        - media_player.echo_speaker
      data:
        type: tts