TTS message and language

Hya,

i have the following automation and it’s allways asking for a text to speak.

I guess i have a text (entered or left).

Anyone able to help me find out what the problem is?

service: notify.mobile_app_pxs10e
data:
  message: TTS
  language: en
  title: |
    {% if trigger.event == "leave" %}
      {{ trigger.from_state.name }} left {{ trigger.zone.attributes.friendly_name }}
    {% else %}
      {{ trigger.from_state.name }} entered {{ trigger.zone.attributes.friendly_name }}
    {% endif %}       

Thx!

See this I just answered for another person.
message is the content (unless you intended on posting “TTS”.

NOTE: notify to a mobile app sends a notification

So this sends a message to my phone:

service: notify.mobile_app_kevin_phone
data:
  message: The BBQ timer is finshed
  title: Thermometer Timer

this works for me. TTS does not. it asks for a message to speak.

I do not understand your question I guess. Please be more clear. Are you wishing to send something to a phone and have spoken outloud? Then (for Android phones) this works:

service: notify.mobile_app_kevin_phone
data:
  message: "TTS"
  data:
    tts_text: "I am a message sent from Home Assistant."

Of course use your own phone …

But if your question is about changing the language, refer to Introduction | Home Assistant Companion Docs

Where it states “Current support is limited to the current Text To Speech locale set on the device.”

This is my entire automation. For data: message: , it works, for data: message TTS, it does not works. It speaks nothing.

id: '802391001'
alias: Zone Notifications
trigger:
  - platform: zone
    entity_id: device_tracker.pxs10e
    zone: zone.home
    event: enter
  - platform: zone
    entity_id: device_tracker.pxs10e
    zone: zone.home
    event: leave
  - platform: zone
    entity_id: device_tracker.pxs10e
    zone: zone.meia_laranja
    event: enter
  - platform: zone
    entity_id: device_tracker.pxs10e
    zone: zone.meia_laranja
    event: leave
  - platform: zone
    entity_id: device_tracker.pxs10e
    zone: zone.psilu_home
    event: enter
  - platform: zone
    entity_id: device_tracker.pxs10e
    zone: zone.psilu_home
    event: leave
action:
  - service: notify.mobile_app_pxs10e
    data:
      message: |
        {% if trigger.event == "leave" %}
          {{ trigger.from_state.name }} left {{ trigger.zone.attributes.friendly_name }}
        {% else %}
          {{ trigger.from_state.name }} entered {{ trigger.zone.attributes.friendly_name }}
        {% endif %}
  - service: notify.mobile_app_pxs10e
    data:
      message: TTS
      tts_text: |
        {% if trigger.event == "leave" %}
          {{ trigger.from_state.name }} left {{ trigger.zone.attributes.friendly_name }}
        {% else %}
          {{ trigger.from_state.name }} entered {{ trigger.zone.attributes.friendly_name }}
        {% endif %}       
mode: single

Please look at that example and compare to yours:

service: notify.mobile_app_kevin_phone
data:
  message: "TTS"
  data:
    tts_text: "I am a message sent from Home Assistant."

It is:

-----> data:
----------> message: “TTS”
----------> data:
---------------> tts_text: “whatever you wish to say”

This is not the structure you show. You are missing the data: key under the data: key and also tts_text then is improperly indented.

This (untested) it what it should be:

  - service: notify.mobile_app_pxs10e
    data:
      message: "TTS"
      data:
        tts_text: |
          {% if trigger.event == "leave" %}
            {{ trigger.from_state.name }} left {{ trigger.zone.attributes.friendly_name }}
          {% else %}
            {{ trigger.from_state.name }} entered {{ trigger.zone.attributes.friendly_name }}
          {% endif %}   
1 Like

thank you for pointing it out. i really was misreading it. solved.