I currently have all of my door sensors grouped together. Then when I set my input_boolen “Away Mode” to On, there is an automation that checks the condition of “Group.doors = on” and sends a generic “Doors are still open” notification.
Is there a way to send a notification of all open doors? So instead of just “…doors are open,” it would say “Mode was changed to Away and the following doors are open: Front door, back door”
I have not been very successful with any for loops or other complex templates. Any help or a head start would be appreciated.
Here’a a template that I use with an alexa intent that will head you down the right path:
it says something like : The bedroom lights are on, the lamp is on, and the office is on. Everything else is off.
{%for state in states
if (
(state.name == "Bedroom Lights") or (state.entity_id.startswith("switch"))
)
and
(state.state=="on")
and
(state.name != "Run Schedules") %}
{%- if loop.first %}The{% elif loop.last -%} and the {%- else -%} the {%- endif %}
{{state.name}}
{% if state.name.endswith('s')%} are {%else%} is {%endif%}
{{state.state}},
{%- if loop.last %}
{%- if loop.index >0 %}
Everything else is off. .
{%endif%}
{%endif%}
{%else%}
Everything is off. .
{%endfor%}