Hi all,
I have a notification script which I use to send notifications to various notify services. I feed this script with a data property called who
. This who can contain for instance husband, wife, daughter, parents, at_home
. Based on this value I do some if ... else
logic within the script to call the correct service mentioned below.
notify.husband
notify.wife
notify.daughter
notify.parents (notify group with notify.husband and notify.wife)
notify.family (notify group with all family members)
This works fine for all scenarios expect the at_home
one. For some automation’s I would like to notify only the people who are at home. For instance if someone is at the door. I know the status of people so that’s not the problem. The problem is that I cant make a dynamic notify group which only contains the people at home.
Does anyone have any idea if and how to make a dynamic notify group where notify services can be added conditionally? Or is there another way to make this dynamically?
Notify script
notify_engine:
sequence:
- service: >
{% if who == 'husband' %}
notify.husband
{% elif who == 'wife' %}
notify.wife
{% elif who == 'daughter' %}
notify.daughter
{% elif who == 'parents' %}
notify.parents
{% elif who == 'family' %}
notify.family
{% elif who == 'at_home' %}
// todo: notify.at_home group
{% else %}
notify.husband
{% endif %}
data_template:
title: "{{ title }}"
message: "{{ message }}"