How to notify using TTS — and much more

Cool, I’m not that familiar with the Hass development workflow. From github it seems this has been developed already. In which Hass release can we expect this? 0.116 already?

Sorry this was supposed to be a reply to @dgomes

Still waiting for a decision on wether to merge or not. Only after that will we know in which version it will get in

3 Likes

Is it possible to do the same for MQTT? Struggling to find a way to publish an MQTT message when an Alert is triggered. Seems you can only call notifiers and there isn’t a way to publish an MQTT message with a notifier?

it requires the development of the notify platform for the mqtt integration…

I am getting an error when testing the first method. This is the error.

Logger: homeassistant.components.rest.notify
Source: /usr/src/homeassistant/homeassistant/components/rest/notify.py:209
Integration: rest (documentation, issues)
First occurred: 9:32:15 AM (4 occurrences)
Last logged: 10:09:52 AM

Client error. Response 400: Bad Request:
NoneType: None

This is in my notify.yaml

notify:
  - name: tts_google
    platform: rest
    resource: http://192.168.1.20:8123/api/services/tts/google_translate_say
    method: POST_JSON
    headers:
      Authorization: !secret llt
      content-type: application/json
    data_template:
      message: "{{ title ~ '\n' ~ message }}"
      entity_id: "{{ data.entity_id | default(states('var.audio_alerts_media_player'),true) }}"
      language: "{{ (data.language | default(states('input_select.audio_language'), true))[0:2] }}"

config.yaml

tts:
  - platform: picotts
    base_url: http://192.168.1.20:8123
    language: 'en-US'
    cache: false
  - platform: google_translate
    base_url: http://192.168.1.20:8123
    language: 'en'

When I try to test using the below, alexa is saying something to the effect of the tts works with notify.media_player.ai_1 service.

I think you can use the new native mechanism :slight_smile:

3 Likes

Configured this today for my alerts, works like a charm!

I am amazon echo user. Getting this error.

Sorry, text to speech can only be called with the notify.alexa_media service. Please see the alexa_media wiki for details.Configuration: Notification Component · alandtse/alexa_media_player Wiki · GitHub

I think the error explains everything…

And since it’s a custom component, you should direct your question to the custom_component author

I am getting randomly TTS not working on my automations… It seems it is working good and sometimes it fails…

Probably an error Unable to find token seed! Did https://translate.google.com change? in your logs?

if so, see:

Can this set after speaking in English with picotts then google tts translate it to germany ? Thanks

1 Like

My understanding is that the actual language spoken depends on the language of the message you send in. If you send a message in English with the language for tts set to de, it will say an English message with a German accent.

Any ideas how you can have your automation send messages in English, and have the TTS service automatically translate to the target language?

Your understanding is right: it is not a translation service, but a Text To Speech service (that ‘coincidentally’ uses the TTS service of Google Translate, simply because it is free and ‘easily’ available). So it will indeed only transform (not translate) text to speech.

That means that you’ll need to translate the input message somewhere else - you can only feed the TTS the already translated message and the correct language: parameter.

I don’t know any translation service that integrates with Home Assistant unfortunately.

Hi,
I’m trying to transform this rest_command to a notify :

rest_command:
tts:
url: ‘http://11.6.168.112:12101/api/text-to-speech?SiteId={{ site }}’
method: ‘POST’
headers:
content_type: ‘text/plain’
payload: ‘{{ lemessage }}’

The notify i’m trying to debug … but i’m stuck.
Could you help me ?

notify:

how can we set volume level for tts in configuration.yaml ?

how can we set volume level for tts in configuration.yaml ?

Hello,

I use piper as my local tts. Now I want to install a notification which uses piper. That works, but just in English, and without the possibility to determin the voice.

notify:
  - name: piper_local
    platform: tts
    entity_id: tts.piper
    media_player: media_player.volumio_mpd
    language: 'de_DE'
    option:
      voice: de_DE-thorsten-medium

‘language’ and ‘voice’ are ignored. The relevant page is very short and does not help me any further: Notify using TTS - Home Assistant

Regards, Eckart

This thread was started four years ago - the information in it may be out of date. It might be better to start a new thread, with a link to this one to provide context if necessary.