Looking for advice. I have read through the existing threads on this topic, and none of them address this concern.
I have an automation intended to notify everyone at home when one of the family members has returned and needs help getting inside. This notification is not useful to people not currently at home, so I want to limit recipients to only devices which are.
I can set a template target in notify.notify, and it works as long as I stay in the editor, although it is a bit verbose:
{% for device in dict(states.device_tracker|groupby('state'))['home'] %}
{% if loop.last and loop.length > 1 %} and
{% elif not loop.first and loop.length > 1 %},
{% endif %}
{{ device.name }}
{% endfor %}
The problem I’m running into is that the moment I leave the editor after verifying that it works, Target is set to null and the automation never works again. Does anyone know why that is, or how I can get it to keep the target? I’m willing to use a notify group if it can be dynamic, but I have yet to see a good example of that.