The script below works fine as long as I specify a sound. But if I don’t pass a sound the script doesn’t execute. Unfortunately there’s no null or silence sound that I could specify as a default.
Could someone point me to a reference for how I might be able to check if a variable was passed, and if not don’t use that field?
Script
alias: Notify Lametric if Office is occupied
sequence:
- if:
- condition: state
entity_id: input_boolean.office_occupied
state: "on"
then:
- service: notify.my_lametric
data:
message: "{{ notification_message }}"
data:
cycles: "{{ display_count }}"
icon: "{{ icon }}"
sound: "{{ sound }}"
mode: single
What I’m trying to do
alias: Notify Lametric if Office is occupied
sequence:
- if:
- condition: state
entity_id: input_boolean.office_occupied
state: "on"
then:
- service: notify.my_lametric
data:
message: "{{ notification_message }}"
data:
cycles: "{{ display_count }}"
icon: "{{ icon }}"
—-> IF sound variable was passed, then pass on “sound: {{ sound }}” ELSE leave blank
mode: single