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 ?
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
notify:
fields:
format:
description: The timestamp format for persistent notifications & notifications. Annoucements do not have a timestamp.
example: "%-I:%M:%S %p"
persistent_notification:
description: On/Off for Persistent Notifications
example: on
title:
description: Title of the persistent notification.
example: "Title"
message:
description: Message to be sent/annouced.
example: "Hello"
notify:
description: Devices to notify.
example: notify.mobile_app_petro
variables:
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 %}
notify.mobile_app_petro
{%- else %}
{{ notify | default('notify.homeowners') }}
{%- endif %}
out_title: >
{{ title | default('') }}
out_message: >
{%- set message = message | default('No Message Provided') %}
{{ '[{}] {}'.format(timestamp, message) }}
sequence:
- choose:
- conditions: "{{ persistent_notification }}"
sequence:
- service: persistent_notification.create
data:
title: "{{ out_title }}"
message: "{{ out_message }}"
- condition: template
value_template: "{{ out_notify.startswith('notify.') }}"
- service: "{{ out_notify }}"
data:
message: "{{ out_message }}"
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’
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.
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
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
trigger:
- platform: time
at: "08:00:00"
condition: []
action:
- service: script.announcement_voice
data:
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
fields:
alexa:
description: What Alexa or Group to send it to. Needs to be specified.
example: everywhere
message:
description: Message to be sent/announced. Needs to be specified.
example: Hello
tts_type:
description: Specify if this is a announcement or a notification
example: tts or announce
variables:
out_msg: |
{{ message | default('No message provided') }}
out_alexa: |
{{ alexa | default('study_room') }}
out_tts_type: |
{{ tts_type | default('tts') }}
sequence:
- choose:
- conditions:
- condition: time
after: "18:00:00"
before: "06:00:00"
sequence:
- service: notify.alexa_media_{{ out_alexa }}
data:
message: >-
<amazon:effect name="whispered"> "{{ out_msg }} "
</amazon:effect> "
data:
type: "{{ out_tts_type }} "
method: all
default:
- service: notify.alexa_media_{{ out_alexa }}
data:
message: "{{ out_msg }} "
data:
type: " {{ out_tts_type }} "
method: all
max: 10