Text to Speech Notification - Help Needed

Hi All,
Complete noob here. On HA for barely a week.
I have setup my HA OS on a HP thinclient.

Recently bought a a Eufy Alarm kit and managed to add it on to HA through the eufy-security-ws add on.

I am trying to create an automation that notifies me if any doors or windows are open when I press the ‘Away’ (alarm_armed) mode on the keypad so I can make sure the house is secure when I leave.

I found an awesome easy to follow tutorial on youtube that does exactly what I need.
The link is here https://youtu.be/wzvL0UTAw44?si=RSIDcFo6GnhlPTzs.

I have the automation working with a normal text notification. But I would like it to be a voice notifications so I know right away what I need to close without having to pull the phone out of the pocket every time.

Below is the code I’m trying but this doesn’t get saved. Tried several versions with quote marks & signs…Nothing has worked. Hoping you guys can help me.

Thanks in advance and the help is much appreciated.

alias: Set Security Alarm Voice
description: |+

trigger:
  - platform: numeric_state
    entity_id: number.homebase_alarm_arm_delay
    above: 0
condition:
  - condition: numeric_state
    entity_id: sensor.no_of_doors_open
    above: 0
action:
  - service: notify.mobile_app_achal_phone
    data:
      message: "TTS"
        data:
          tts_text: "Following Doors or Windows are still open" + {{',' + states('sensor.what_doors_are_open') }}
          media_stream: "alarm_stream"
mode: single

The second data should be at the same depth as message:

  - service: notify.mobile_app_achal_phone
    data:
      message: "TTS"
      data:
        tts_text: "Following Doors or Windows are still open, {{states('sensor.what_doors_are_open')}}"
        media_stream: "alarm_stream"
1 Like

@Didgeridrew
That worked!
Thank you so much.

I’m used to tinkering in VB so this is very counterintuitive for me. Never would have figured this out on my own!

Just 1 more question. Is there a way to add a little bit of pause between the sentences?
It’s not so easy to understand in the notification as the whole notification is just rattled off in one go.

A comma (,) will give a very short pause, a period (.) will give a short pause. For longer pauses you can use SSML:

- service: notify.mobile_app_achal_phone
    data:
      message: "TTS"
      data:
        tts_text: |
          {{ '<speak>Following Doors or Windows are still open<break time="2s"/>' 
          ~ states('sensor.what_doors_are_open') ~ '</speak>' }}
        media_stream: "alarm_stream"