Way to make everything have a whispered effect at night?

Hi all,

Is there a way of having all my messages i want to put as tts, and convert them to include below effect tags?

<amazon:effect name="whispered">Goodnight person</amazon:effect>.

Could i reference a script or variable in actions maybe that does this ?
It’s a roundabout way but the only way unless i manually put these effect tags for every automation…


make a notification automation with the mode set to parallel. Then in all your automations, call that service instead of your notify service. Inside your script, you’ll except a message variable and use it in the message fields. Use a choose action to have a whispered effect at night and a non whispered effect during the day.

Thanks petro. Am i understanding your comment correctly ?

So i create a new automation and set it to parallel mode.
This automation calls the script.

Other automations that i want to have whispered output i call the above automation. How does the message from these automations get passed to the above ?

I guess i’ll just need to figure out the script.

Many thanks for your suggestion.

No you create a new script and set it to parallel mode. You then use that script in whatever automation you have that would be notifying you instead of using the notify service.

Here’s an example script and it’s use

      description: The timestamp format for persistent notifications & notifications.  Annoucements do not have a timestamp.
      example: "%-I:%M:%S %p"
      description: On/Off for Persistent Notifications
      example: on
      description: Title of the persistent notification.
      example: "Title"
      description: Message to be sent/annouced.
      example: "Hello"
      description: Devices to notify.
      example: notify.mobile_app_petro
    timestamp: >
      {%- set format = format | default("%-I:%M:%S %p") %}
      {{ as_timestamp(now(), none) | timestamp_custom(format, default="???") }}
    persistent_notification: >
      {{ persistent_notification | default(true) }}
    out_notify: >
      {%- if debug %}
      {%- else %}
        {{ notify | default('notify.homeowners') }}
      {%- endif %}
    out_title: >
      {{ title | default('') }}
    out_message: >
      {%- set message = message | default('No Message Provided') %}
      {{ '[{}] {}'.format(timestamp, message) }}
  - choose:
    - conditions: "{{ persistent_notification }}"
      - service: persistent_notification.create
          title: "{{ out_title }}"
          message: "{{ out_message }}"
  - condition: template
    value_template: "{{ out_notify.startswith('notify.') }}"
  - service: "{{ out_notify }}"
      message: "{{ out_message }}"

using it

- service: script.notify
    persistent_notification: on
    title: "XYZ"
    messge: "XYZ"
    notify: notify.mobile_app_atv

It’ll notify your mobile app and create a persistent notification in the lower corner at the same time. With a timestamp.

You can alter the script to do whatever you want, again this is just an example.

Got it, super useful.

I will google this and post it here once i have something working.

nothing to google, you have the example above that does exactly this

see these docs for further explanation of variables.

My bad, didn’t scroll all the way down.

Thank you petro, that’s awesome. I might regret this though, having alexa whisper to you at night is extremely unsettling :slight_smile:

1 Like

Feeling a bit silly here, the script you listed is a script correct ? Should i be able to paste that as add script → new script → edit in yaml and paste it ?

I tried this and i’m getting : ```extra keys not allowed @data’notify’

Yep, but if you’re doing this in the UI you don’t include the first line because that’s auto generated for you.

Cheers, i just got it working by doing exactly that, i think the notify: section is all description and as you said auto-generated. So i pasted starting at the variable section and that worked.

Thanks again.

No problem, if you need help with your choose and variables, let me know. What you’re trying to do is not easy for beginners.

1 Like

Just to conclude this topic and for those that might need it: I came up with this simplified version of the script and automation above (e.g. i removed the bits i didn’t understand yet). Do let me know if i should have left something in :slight_smile:

The automation that allows for a message, tts notification type and the alexa (or defined speaker group) to be passed on:

alias: Announcement Voice Test
description: Using regular speech or whisper voice in script called announcement voice
  - platform: time
    at: "08:00:00"
condition: []
  - service: script.announcement_voice
      alexa: study_room
      tts_type: tts
      message: Goodnight atv
mode: single

And the script it calls, allowing for defaults in case none were passed on so the script can be called on it’s own.

alias: Announcement Voice
mode: parallel
    description: What Alexa or Group to send it to. Needs to be specified.
    example: everywhere
    description: Message to be sent/announced. Needs to be specified.
    example: Hello
    description: Specify if this is a announcement or a notification
    example: tts or announce
  out_msg: |
    {{ message | default('No message provided') }}
  out_alexa: |
    {{ alexa | default('study_room') }}
  out_tts_type: |
    {{ tts_type | default('tts') }}
  - choose:
      - conditions:
          - condition: time
            after: "18:00:00"
            before: "06:00:00"
          - service: notify.alexa_media_{{ out_alexa }}
              message: >-
                <amazon:effect name="whispered"> "{{ out_msg }} "
                </amazon:effect> "
                type: "{{ out_tts_type }} "
                method: all
      - service: notify.alexa_media_{{ out_alexa }}
          message: "{{ out_msg }} "
            type: " {{ out_tts_type }} "
            method: all
max: 10

If you’re interested you can eliminate the choose by doing this:

  - variables:
      msg: >
        <amazon:effect name="whispered"> "{{ message }} "
        </amazon:effect> "
  - service: notify.alexa_media_{{ alexa }}
      message: >
        {{ msg if (now().hour >= 18 or now().hour < 6) else message }}
        type: " {{ tts_type }} "
        method: all
1 Like

Good to know, i’ll play around with that.