TTS fallback when Internet goes down

Hello there,
I was wondering if there is a way of configuring multiple TTS platforms (e.g. one cloud-based and one offline) and fallback to the offline one when the Internet goes down. I mean without writing a custom component or a script.

Thank you!

Yes you can, I would do it like this:

Configure multiple TTS platforms.
Create an input_select that contains one option for each TTS services, like “tts.google_translate_say”, “tts.mary_tts_say” etc.
Create an automation that changes the input_select to the desired option when internet goes down/comes up again.
Use the value from the input select as your service in all your automations that use TTS.


Thanks for the suggestion, but how about a real fallback? E.g. if Google fails to provide voice data for whatever reason? That is, try Google and if it fails use Mary?

Your idea made me think about something. I can see that using separate scripts (one for each TTS platform) exceptions are thrown separately and the calling sequence would continue. I could use an input_select that would be set to true if the first TTS platform succeeds. An example would be (in pseudo-HA-code):

script tts_say:

  • call script.google_say
  • call script.mary_say

script google_say:

  • set input_select to false
  • call Google TTS
  • set input_select to true <-- Google worked

script mary_say:

  • if input_select is false, call Mary

If the input_select is false, Mary won’t be called because of the condition I’d put.

I’ll do some tests and post my results. Thank you!

P.S. I will soon share my whole HA configuration

Ah yes, didn’t think about this, probably because I only use Mary :slight_smile:

Your approach to overcome this issue sounds good.

And please tag me when you post your full configuration. In case you are interested, you can take a look at mine here, it’s a huge work in progress at the moment, as I’m restructuring the system and some parts are not online yet.

I will! Thanks for sharing yours, I’ll be curiously diving into it.

Don’t dive too deep :rofl: As soon as I finished my restructuring, I will update my repo and also add some detailed instructions and then post it here on the forum.
Should you have any questions about my setup, feel free to send me a PM.

1 Like

It took some time, but I finally did it.